Xcode 下架构 x86_64 的重复符号 [英] Duplicate symbols for architecture x86_64 under Xcode

查看:30
本文介绍了Xcode 下架构 x86_64 的重复符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有与上述标题相同的问题,但还没有找到正确的答案.我收到错误:

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 添加到了 Other Linker Flags.删除此值后,我可以成功构建我的项目,但我不知道为什么.谁能解释一下?

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?

推荐答案

就我而言,我只是创建了一个头文件来定义这样的常量字符串:

In my case, I just created a header file to define constant strings like this:

NSString *const AppDescriptionString = @"Healthy is the best way to keep fit";

我通过使用 static 解决了这个场景:

I solved this scenario by using static:

static NSString *const AppDescriptionString = @"Healthy is the best way to keep fit";

这篇关于Xcode 下架构 x86_64 的重复符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆