Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML 2 plus Xcode4 on Lion architecture build error  (Read 2018 times)

0 Members and 1 Guest are viewing this topic.

bobdobbs3

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML 2 plus Xcode4 on Lion architecture build error
« on: September 27, 2011, 12:56:34 am »
I get the following after building using CMake and copying the frame works over to /Library/Frameworks.

I used CMake, only changing the defaults to use 10.7 instead of 10.6 and to get around which freetype I linked to.  Otherwise it was whatever CMake wanted to use.

CMAKE_OSX_ARCHITECTURES i386;x86_64

Just ran make after that and then tried to do a simple test and got the following errors.  

Any help would be much appreciated.

Quote
Undefined symbols for architecture x86_64:
  "sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
      _main in main.o
  "sf::Window::Window(sf::VideoMode, std::string const&, unsigned long, sf::ContextSettings const&)", referenced from:
      _main in main.o
  "sf::Window::~Window()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)




Quote
#include <iostream>
#include <SFML/Window.hpp>


int main (int argc, const char * argv[])
{

    sf::Window(sf::VideoMode(800, 600, 32), "SFML OpenGL");
   
    std::cout << "Hello, World!\n";
    return 0;
}

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
SFML 2 plus Xcode4 on Lion architecture build error
« Reply #1 on: September 27, 2011, 01:40:05 am »
did you run sudo make install after running make?

that should put everything where it should go

also you might need to link the right libraries in when you compile if you are doing it from the command line, -lsfml-window etc.

bobdobbs3

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML 2 plus Xcode4 on Lion architecture build error
« Reply #2 on: September 27, 2011, 06:25:15 am »
I got it.  I needed to explicitly link sfml-window.framework not just SFML.framework.   Well that was a total PEBCAK issue.

Thanks for the response!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML 2 plus Xcode4 on Lion architecture build error
« Reply #3 on: September 27, 2011, 06:31:32 pm »
It's not very important but you don't need to link against SFML.framework. In fact, this framework only exists for convenience : it only contains the SFML headers.

However if you want to (i.e. you don't want to change the settings of your project) link against it you can, it won't have any impact on runtime nor compile-time.
SFML / OS X developer

bobdobbs

  • Newbie
  • *
  • Posts: 2
    • View Profile
SFML 2 plus Xcode4 on Lion architecture build error
« Reply #4 on: September 28, 2011, 07:37:43 am »
Thanks for the tip.  I'm just trying to get a test project set up to experiment in before I add  SFML to some older code to replace SDL so changing it now isn't as issue.

Cheers!