Xcode下架构x86_64的重复符号 [英] Duplicate symbols for architecture x86_64 under Xcode
问题描述
我现在对上面的标题有同样的问题,但还没有找到正确的答案。我收到错误:
I now have the same question with above title but have not found the right answer yet. I got the error:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
duplicate symbol _OBJC_METACLASS_$_MoboSDK in:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
ld: 75 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
感谢任何帮助。
终于我找出了这个错误的原因,因为我将 -ObjC
添加到其他链接器标志
。删除此值后,我可以成功构建我的项目,但我不知道为什么。任何人都可以解释这个吗?
Finally I find out the reason of this error cause I added -ObjC
to the Other Linker Flags
. After remove this value then I can build my project successfully, but I don't know why. Can anyone explain this?
推荐答案
75个体系结构的重复符号x86_64
75 duplicate symbols for architecture x86_64
表示您已经加载了两次相同的函数。
因为从其他链接器标志中移除
-ObjC
后问题消失,
这意味着此选项导致函数加载两次:
Means that you have loaded same functions twice.
As the issue disappear after removing -ObjC
from Other Linker Flags,
this means that this option result that functions loads twice:
来自Technical Q& A
from Technical Q&A
此标志使链接器加载定义Objective-C类或类的库
中的每个目标文件。虽然这个选项
通常会导致更大的可执行文件(由于加载到应用程序中的额外目标代码
),但它将允许成功创建包含类别的
有效Objective-C静态库on
现有类。
This flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.
https://developer.apple.com/library/content/qa/qa1490/_index.html
这篇关于Xcode下架构x86_64的重复符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!