编译时重复符号错误,第一次看到这个错误

时间:2015-03-23 19:48:14

标签: ios objective-c xcode

我在尝试编译时遇到重复的符号错误。错误信息是:

duplicate symbol _OBJC_IVAR_$_SideBarCell._profilePic in:
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/SideBarCell.o
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/TabViewController.o
duplicate symbol _OBJC_CLASS_$_SideBarCell in:
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/SideBarCell.o
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/TabViewController.o
duplicate symbol _OBJC_METACLASS_$_SideBarCell in:
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/SideBarCell.o
    /Users/kex/Library/Developer/Xcode/DerivedData/myProject-aoizqcetllkwnxgbqvmjyrxmxrbw/Build/Intermediates/myProject.build/Debug-iphoneos/myProject.build/Objects-normal/arm64/TabViewController.o
ld: 3 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我根本不熟悉这种类型的错误。我的项目中的引用是否被混淆了?非常感谢对此提出一些建议!!!

1 个答案:

答案 0 :(得分:1)

潜在原因 - 我:

更有可能的是,您的一个(.m.h)文件中有多个文件在您的项目中同名。

潜在原因-II:

您可以添加file.m代替file.h