I was going to migrate my game from glut to sdl.
It's working perfectly in glut but I wanted to use some sdl features.
So I go into my project properties, under the targets header I click the program that will be compiled, build phases, link binary with libraries, add SDL.framework
The exact same as I have done for OpenGL.framework and GLUT.framework
However when I add: #include <SDL/SDL.h>
it comes up with a linker error when I try to build:
Undefined symbols for architecture x86_64:
"_main", referenced from:
__start in crt1.o
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Googling simply leads to a fair few results, but no real explanations.
SDL uses a macro to rename your main(..)
and should supply its own, usually implemented in SDLmain.m
. It should be supplied together with the SDL.framework.
When you download the framework from here http://www.libsdl.org/download-1.2.php Read the ReadMeDevLite.txt
in the devel-lite
folder.
Another description http://www.meandmark.com/sdlopenglpart2.html