If you only want a classic binary (i.e., you don't want an application bundle) then you can do pretty much like on any Unix :
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
if you use dylibs or
g++ main.o -o sfml-app -framework sfml-graphics -framework sfml-window -framework sfml-system
if you use frameworks.
Now I get:
-------------- Build: Debug in Test ---------------
Compiling: main.cpp
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp: In function 'int main()':
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:6: error: 'Text' is not a member of 'sf'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:6: error: expected `;' before 'text'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:8: error: 'class sf::RenderWindow' has no member named 'isOpen'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:11: error: 'class sf::RenderWindow' has no member named 'pollEvent'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:13: error: 'class sf::Event' has no member named 'type'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:14: error: 'class sf::RenderWindow' has no member named 'close'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:17: error: 'class sf::RenderWindow' has no member named 'clear'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:18: error: 'class sf::RenderWindow' has no member named 'draw'
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:18: error: 'text' was not declared in this scope
/Users/Jeffrey/Desktop/TestProject/Test/main.cpp:19: error: 'class sf::RenderWindow' has no member named 'display'
Just an idea, not sure about it, but did you uninstall SFML 1.6 before installing 2.0 RC ? Maybe the installer didn't override the old headers. Can you confirme this by showing me what prints the following command in a Terminal ?
perl -ne 'BEGIN { $found = 0; print "\n\n\n"; } END { if ($found == 0) { print "SFML 1.x\n\n\n"; } else { print "SFML 2.x\n\n\n"; } } $found = 1 if m/#define SFML_VERSION_MAJOR 2/' /usr/local/include/SFML/Config.hpp
If it prints "SFML 1.x" then run the following command before reinstalling SFML 2.0 RC with the installer :
rm -r /usr/local/include/SFML
(Note : if it fails because of access right, juste type sudo !! right after the last command and enter your password as prompted.)
Now your project should compile fine, at least in C::B.
I'd like to move to Netbeans. I tried it and it seems to work fine with normal setting. It also has makefile which may simplify things. Could you please tell me how to set SFML up (2.0 if possible) on that?
Well, I don't know how NetBeans works with C++ (I only used it some years ago for Java development) but I guess it's pretty much the same as any IDE : you need to find three thing :
- where the compiler should search for headers (option -I of gcc)
- where the linker should search for libraries (-L) or frameworks (-F)
- which libraries the linker should link against (-l ← it's an ell)
like you did in C::B.
You will probably find that on the web.
Now if you use Makefiles, you need to know how they work. I didn't read this tutorial (http://mrbook.org/tutorials/make/) but it should help you, I guess. You can also have a look at the documentation (http://www.gnu.org/software/make/manual/make.html).
Also please note that after the installation of 2.0 in /Developer/usr/local/ there's just one folder: bin/; there's no include/ nor lib/.
Why did you install SFML in /Developer ? (This folder is removed with future version of Xcode, you probably should not use it anymore. Use instead /usr/local as explained in the tutorial.)
Great!
Just an idea, not sure about it, but did you uninstall SFML 1.6 before installing 2.0 RC ? Maybe the installer didn't override the old headers. Can you confirme this by showing me what prints the following command in a Terminal ?
perl -ne 'BEGIN { $found = 0; print "\n\n\n"; } END { if ($found == 0) { print "SFML 1.x\n\n\n"; } else { print "SFML 2.x\n\n\n"; } } $found = 1 if m/#define SFML_VERSION_MAJOR 2/' /usr/local/include/SFML/Config.hpp
Did you run the command ?