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;.
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