我现在也有同样的问题,但还没有找到正确的答案。我得到了错误:
/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到其他链接器标志。在删除这个值之后,我可以成功地构建我的项目,但我不知道为什么。有人能解释一下吗?
我在Xcode 7.3中打开的一些遗留项目的情况是:
duplicate symbol _SomeEnumState in:
下面是两个不相关的文件。哦,然后这句话重复了几次,最后:
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
为我解决它的是改变枚举声明:
enum SomeEnumState {
SomeEnumStateActive = 0,
SomeEnumStateUsed = 1,
SomeEnumStateHidden = 2
} SomeEnumState;
:
typedef NS_ENUM(NSUInteger, SomeEnumState) {
SomeEnumStateActive = 0,
SomeEnumStateUsed = 1,
SomeEnumStateHidden = 2
};
如果有人对此有解释,请开导我。
我发现公认的答案涉及到这个问题,但没有帮助我解决它,希望这个答案将有助于解决这个非常令人沮丧的问题。
duplicate symbol _OBJC_IVAR_$_BLoginViewController._hud in:
17 duplicate symbols for architecture x86_64
意味着你已经加载了相同的函数两次。当从其他链接器标志中删除-ObjC后,问题消失了,这意味着该选项导致函数加载两次:
通俗地说,这意味着我们的项目中有两个名称完全相同的文件。也许你正在将一个项目合并到另一个项目中?看看上面的错误“重复符号”错误,看看哪个文件夹是重复的,在我的情况下,它是BLoginViewController。
例如,在下图中,你可以看到我有两个BImageViewControllers,对我来说,这是导致问题的原因。
只要我删除了一个,问题就消失了:)
今天,我得到了同样的错误。错误的关键字是duplicate。我通过:
1. Remove the duplicate file at Build Phases-->Compile Sources
2. If you can not remove it at Build Phases, you need find the file at your project and remove the reference by DELETE :
3. Add the file to your project again
4. Add the file's .m to your Build Phases-->Compile Sources again
5. Build your project, the error will disappear