Problem using SFML with GCC and OS X

I tried to get SFML to work for a while, and I tried to get it to work using GCC. By the way, I'm on OS X. I followed the standard Linux instructions and use the 64-bit Linux boot, but when it comes to compiling ...

g++ -o testing main.cpp -lsfml-system

It happens:

main.cpp: In functionint main()’:
main.cpp:7: error: ‘class sf::Clockhas no member namedGetElapsedTimemain.cpp:9: error: ‘class sf::Clockhas no member namedGetElapsedTimemain.cpp:10: error: ‘Sleepis not a member ofsf

So, I thought this might be due to being not used, so I changed the gcc compilation command to:

 g++ -o testing main.cpp -I ~/SFML-1.6/include/ -lsfml-system

and now I get this error:

ld: warning: ignoring file /usr/local/lib/libsfml-system.so, file was built for     unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
  "sf::Clock::Clock()", referenced from:
      _main in ccZEiB7b.o
  "sf::Clock::GetElapsedTime() const", referenced from:
      _main in ccZEiB7b.o
  "sf::Sleep(float)", referenced from:
      _main in ccZEiB7b.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status**

And I have no idea what to do to fix it.

+3
source share
2 answers

Short answer

Add a flag -arch i386(on mac) or -m32(on linux)

Long answer

sfml-system 32 , 64 . .

SFML 64 , , 64 .

+2

SFML , OS X. SFML lib64 /Library/Frameworks ( SFML.framework, sfml-system.framework .. /Library/).

, -framework g++ :

g++ -o testing main.cpp -framework SFML -framework sfml-system
0

All Articles