本文介绍了XCode 4.3.2 SDLMain.o 中的 SDL 未定义符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始尝试在 Xcode 4.3.2 中使用 SDL,所以我为 Mac OS X 启动了一个 Cocoa 应用程序,并连接了我所有的框架:OpenGL、SDL 等.我没有 SDL_Image、SDL_Mixer 等(我有吗?需要这些吗?)当我尝试编译只有 SDLmain.h 和 SDLmain.m 的项目时,出现此错误:

I have started trying to use SDL in Xcode 4.3.2 so I started up a Cocoa application for Mac OS X and connected all my frameworks : OpenGL, SDL etc. I don't have SDL_Image, SDL_Mixer etc. (Do I need these?) When I try to compile the project that just has SDLmain.h and SDLmain.m I get this error:

Undefined symbols for architecture x86_64: "_SDL_main", referenced from: -[SDLMain applicationDidFinishLaunching:] in SDLMain.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

推荐答案

我在 Xcode 4.5 和 OS X 10.7 上使用 SDL 1.2.15 时遇到了同样的问题,结果是我添加了 SDLMain.mSDLMain.h(根据 libSDL 网站上有关 OS X 框架的建议)添加到与 main 混淆的现有 SDL 项目.最重要的是,您不需要这些文件只是因为您使用的是 Cocoa——SDL 自己的测试应用程序也不使用它,并且在 OS X 上运行得很好.

I was having the same issue with SDL 1.2.15 on Xcode 4.5 and OS X 10.7, turned out the problem was that I added SDLMain.m and SDLMain.h (according to a suggestion on the libSDL website about OS X frameworks) to an existing SDL project which messed up with main. Bottom line is that you don't need those files just because you are using Cocoa -- SDL's own test apps don't use it either and run just fine on OS X.

这篇关于XCode 4.3.2 SDLMain.o 中的 SDL 未定义符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-28 19:24