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

Author Topic: Xcode project doesn't link to SFML framework if 'Header Search Path' is set  (Read 3008 times)

0 Members and 1 Guest are viewing this topic.

Aaron

  • Newbie
  • *
  • Posts: 5
    • View Profile
I have an Xcode project, using Xcode v3.2.6 on Mac OS X 10.6.8.
I've added the SFML 2.0 frameworks to it - SFML.framework and all of the sfml-<subsystem>.frameworks, located in /Library/Frameworks. This compiles fine.

However, I also need to include a static library, the headers in /usr/local/include and the .a files in /usr/local/lib.
My understanding of Xcode is, in order to use headers and libraries kept in /usr/local, I have to go to my project settings and add /usr/local/include to my Header Search Paths.

The problem is when I do that, my project is unable to link to the SFML framework(s).

This is the entirety of my code:
// main.cpp
#include "SFML/Graphics.hpp"

int main (int argc, char * const argv[])
{
        sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
        return 0;
}
I get a "Symbol(s) not found) error where I try to initialize the window.
Strangely enough, the linker error goes away when I take out the constructor so that it just reads sf::RenderWindow window;.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
what's the exact error ?
SFML / OS X developer

Aaron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Build space-rpg-editor of project space-rpg with configuration Debug

Ld build/Debug/space-rpg-editor normal x86_64
cd /Users/<my username>/game-dev/space-rpg
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/<my username>/game-dev/space-rpg/build/Debug -F/Users/<my username>/game-dev/space-rpg/build/Debug -filelist /Users/<my username>/game-dev/space-rpg/build/space-rpg.build/Debug/space-rpg-editor.build/Objects-normal/x86_64/space-rpg-editor.LinkFileList -mmacosx-version-min=10.6 -lRocketControls -lRocketCore -framework SFML -framework sfml-audio -framework sfml-graphics -framework sfml-system -framework sfml-window -o /Users/<my username>/game-dev/space-rpg/build/Debug/space-rpg-editor

Undefined symbols:
  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
This constructor doesn't exist anymore. The new one takes a sf::String instead of a std::string. I guess you have an old version of the SFML headers in /usr/local/include, probably the RC. Delete that one.
SFML / OS X developer

Aaron

  • Newbie
  • *
  • Posts: 5
    • View Profile
You were right. There was an old SFML install in my /usr/local/ directory, and deleting it got rid of my compile error. Thanks.

 

anything