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

Author Topic: SFML2 with XCode 4.5.2  (Read 2153 times)

0 Members and 1 Guest are viewing this topic.

Xaychru04

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
SFML2 with XCode 4.5.2
« on: January 01, 2013, 11:40:03 pm »
Hi all,
I've got a mac a few days ago and today I tried to use SFML2 with XCode (4.5.2), but I had some problems:
After reading and trying many things said on the forum, I found this tutorial, so that's what I did:

-Downloaded the .zip on github, and put the content in a "SFML" folder
-In CMake, "Where are the sources" I chose this folder
-"Where to build" I chose a folder called "SFMLBuild"
-Then I clicked "Configure", with Unix makefiles
-I selected all the options, excepted the doc
-Clicked "Configure" again and then "Generate"

At this point all was working and I had some files in my "SFMLBuild" directory.

-Then I opened a terminal and wrote "make clean"
-I wrote "make install"
-After a moment, it was done, without any error.

So I opened XCode, created a new SFML application, with either the dylibs or the frameworks (same result).
But when I tried to compile it, there was 6 errors like that:
"sf::RenderWindow::RenderWindow(sf::VideoMode, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:
      _main in main.o
And a the end:
(null): Symbol(s) not found for architecture x86_64


I really don't know what to do, I've seen that the tutorial is for XCode 4.2.1, but I don't think that's the problem.
So thank you very much if you can help me :)
« Last Edit: January 02, 2013, 10:40:37 pm by Xaychru04 »


Xaychru04

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: SFML2 with XCode 4.5.2
« Reply #2 on: January 02, 2013, 07:41:48 pm »
Thank you for the links, I've tested a lot of things but I got the same result :/

Quote
Moreover, you will need to compile SFML yourself with these tools. Follow the tutorial but instead of choosing Use default native compilers you need to select Specify native compilers. Then put /usr/bin/clang toolchain for the C compiler and /usr/bin/clang++ for the C++ compiler and click Done. Next, display the advanced settings and add -stdlib=libc++ to the CMAKE_CXX_FLAGS variable. Finally, complete the CMake tutorial as usual and jump to Create your first SFML program below.

I did that too, testing with either "make install" and "make all", making debug and release files but it still didn't work ><
By the way, should I choose dylibs or frameworks when I create my project ? I've seen that in the tutorial but I don't understand the differences between this options...


Edit:
I put the SFML libs and includes in the "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr" folder 
and now it works perfectly !
Thank you for trying to help me ;)
« Last Edit: January 02, 2013, 10:39:33 pm by Xaychru04 »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML2 with XCode 4.5.2
« Reply #3 on: January 03, 2013, 12:07:01 pm »
glad it works (even if it's not the best solution :P ) !
SFML / OS X developer