Simply including SDL header causes linker error

 ̄綄美尐妖づ 提交于 2019-11-28 12:04:42
epatel

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

Terry Rice

I have found that when I get the error :

Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
(maybe you meant: _SDL_main)

I have forgotten to go to Project -> Build Phases -> Compile Sources and add SDLMain.m to the list. This solved the problem for me right away.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!