如何修复此重复符号错误?
从我收到的错误中:
ld: duplicate symbol _main in /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/fmdb.o and /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/main.o for architecture i386
我无法弄清楚为什么会发生此错误。我只是更改了项目中的一些框架文件,现在这个错误不会消失!它显然说 _main 正在被重复,但我不知道在哪里,或者为什么?
是什么原因造成的?
From the error I am getting:
ld: duplicate symbol _main in /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/fmdb.o and /Users/wostler/Library/Developer/Xcode/DerivedData/UIPageViewControllerDemo-hjsgatcuhsxeokdnubifybpivzum/Build/Intermediates/UIPageViewControllerDemo.build/Debug-iphonesimulator/UIPageViewControllerDemo.build/Objects-normal/i386/main.o for architecture i386
I can't figure out why this error is occurring. I simply changed some framework files in my project and now this error won't go away! It obviously says _main is being duplicated, but I dont know where, or why?
What is causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要查看 main.m/.h 和 fmdb.m/.h 文件。最有可能的是,他们都在导入定义 _main 的东西,也许是在全局级别。通常这就是为我生成此错误的原因。
You need to look at the main.m/.h and fmdb.m/.h files. What is most likely is that they are both importing something that defines _main, perhaps at a global level. Usually thats the sort of thing that generates this error for me.
您的代码中有两个
main
函数。对main
进行全局搜索并删除您不需要的。当您将其他项目的文件添加到您的项目而不删除
main
函数时,就会发生这种情况。You have two
main
function in your code. Do a global search formain
and remove the one you don't want.It happens when you add some other project's files to your project without remove the
main
function.听起来您在“目标/编译源”下有多个条目。检查并删除它们。
Sounds like you have multiple entries under Targets/Compiled Sources. Check and remove them.