Xcode中的重复符号错误

前端之家收集整理的这篇文章主要介绍了Xcode中的重复符号错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在添加自己的框架后尝试构建项目时,我在 Xcode 4.5.1中遇到“重复符号”错误.我验证了重复项的框架文件,但没有.但是当我将框架添加到项目中时,它会抱怨这些错误.请建议..
duplicate symbol _NXArgc in:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
/Users/idcc/Test/MyFW/Products/MyTestFW.framework/MyTestFW

duplicate symbol _NXArgv in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
/Users/idcc/Test/MyFW/Products/MyTestFW.framework/MyTestFW

duplicate symbol ___progname in:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
/Users/idcc/Test/MyFW/Products/MyTestFW.framework/MyTestFW

duplicate symbol _environ in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
/Users/idcc/Test/MyFW/Products/MyTestFW.framework/MyTestFW

duplicate symbol start in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/crt1.3.1.o
/Users/idcc/Test/MyFW/Products/MyTestFW.framework/MyTestFW
ld: 8 duplicate symbols for architecture armv7
clang: error: linker command Failed with exit code 1 (use -v to see invocation)

提前致谢..

解决方法

这些符号位于crt.o中,即标准C库的启动代码.通常,它应该是可执行文件的入口点,以初始化全局变量和对象.它也会调用你的主要功能.

但是对于框架,您不应该将它包含在二进制文件中,因为框架不应该包含main.
我相信您在框架的目标构建设置中将“链接标准库”选项设置为“是”.这会将crt.o链接到您的框架中.当您将框架链接到项目时,将会有重复的符号.

请在构建设置中将“标准库链接”选项设置为“否”.

原文链接:https://www.f2er.com/iOS/335311.html

猜你在找的iOS相关文章