在尝试编译我编写的一个简单程序(密码)时,我收到以下错误。我知道我有一个重复的符号_OBJC_METACLASS _ $ _ Cipher,但我不确定导致这种情况发生了什么。我试着查看我是否偶然两次进口东西,但一切都很好。任何帮助深表感谢! :)
Ld "/Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Products/Debug-iphonesimulator/Caesar Shift.app/Caesar Shift" normal i386
cd "/Users/Lukas/Documents/Programming/iPhone Applications/Caesar Shift"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Products/Debug-iphonesimulator -F/Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Products/Debug-iphonesimulator -filelist "/Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Intermediates/Caesar Shift.build/Debug-iphonesimulator/Caesar Shift.build/Objects-normal/i386/Caesar Shift.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Products/Debug-iphonesimulator/Caesar Shift.app/Caesar Shift"
ld: duplicate symbol _OBJC_METACLASS_$_Cipher in /Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Intermediates/Caesar Shift.build/Debug-iphonesimulator/Caesar Shift.build/Objects-normal/i386/CaesarShiftViewController.o and /Users/Lukas/Library/Developer/Xcode/DerivedData/Caesar_Shift-drfzwlpgygkbcifoefghycamkoya/Build/Intermediates/Caesar Shift.build/Debug-iphonesimulator/Caesar Shift.build/Objects-normal/i386/CaesarShiftAppDelegate.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:4)
以下是造成此错误的两个可能原因:
您已将@implementation Cipher
放入头文件(可能是Cipher.h
头文件)中,并且您已在CaesarShiftViewController.m
和{{1}中导入了该头文件}。 CaesarShiftAppDelegate.m
语句位于@implementation
文件中,而不是.m
文件中。
您在.h
和Cipher.m
中意外导入了CaesarShiftViewController.m
。您应该导入CaesarShiftAppDelegate.m
(注意后缀!)。
正如HachiEthan在评论中指出的那样,您可能已在Cipher.h
文件中导入Cipher.m
(在“支持文件”组中)。所有Caeser Shift-Prefix.pch
文件都会自动导入此文件,因此它与上面的#2具有相同的效果。