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

Author Topic: Can't get SFML working with OS X  (Read 3512 times)

0 Members and 1 Guest are viewing this topic.

Tsirppa

  • Newbie
  • *
  • Posts: 3
    • View Profile
Can't get SFML working with OS X
« on: May 20, 2013, 06:50:03 am »
Hey,

I downloaded SFML 2.0 for OS X with clang for C++11. I installed the 'lib' and the 'include' in my '/usr/local/' folder. After that, I installed the dependencies from the 'extlibs'-folder to my '/Library/Frameworks'. SFML should be correctly installed now? However, I tried the sample program given at http://sfml-dev.org/documentation/2.0/ but I can't get it to compile. Any idea what's going on?

Here's the compile log:
Code: [Select]
clang++ -c main.cpp
clang++ main.o -o sfmltesti -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
Undefined symbols for architecture x86_64:
  "sf::Font::loadFromFile(std::string const&)", referenced from:
      _main in main.o
  "sf::Music::openFromFile(std::string const&)", referenced from:
      _main in main.o
  "sf::String::String(char const*, std::locale const&)", referenced from:
      _main in main.o
  "sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)", 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)
make: *** [all] Error 1
[Finished in 0.3s with exit code 2]

Cornstalks

  • Full Member
  • ***
  • Posts: 180
    • View Profile
    • My Website
Re: Can't get SFML working with OS X
« Reply #1 on: May 20, 2013, 07:44:23 am »
You need to tell clang you're using libc++ (the implementation of the standard library that supports C++11). The default implementation of the standard library doesn't support C++11, so SFML was built with libc++. By not specifying libc++ in your building options, clang is using the other implementation, so you get conflicts that result in weird errors (because SFML wants one, but you're using the other).

Add -stdlib=libc++ to you call to clang++

Tsirppa

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can't get SFML working with OS X
« Reply #2 on: May 20, 2013, 10:45:19 am »
You need to tell clang you're using libc++ (the implementation of the standard library that supports C++11). The default implementation of the standard library doesn't support C++11, so SFML was built with libc++. By not specifying libc++ in your building options, clang is using the other implementation, so you get conflicts that result in weird errors (because SFML wants one, but you're using the other).

Add -stdlib=libc++ to you call to clang++
Well that was simple. Thanks! Now off to learning SFML, a lot of stuff to cover :P

 

anything