1

尝试编译我编写的简单程序(密码)时出现以下错误。我知道我有一个重复的符号 _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)
4

1 回答 1

4

以下是此错误的两个可能原因:

  1. 您已经放入@implementation Cipher了一个头文件(可能是Cipher.h头文件),并且您已经将该头文件导入CaesarShiftViewController.mCaesarShiftAppDelegate.m. @implementation语句进入文件,而.m不是.h文件。

  2. 您不小心导入Cipher.mCaesarShiftViewController.mCaesarShiftAppDelegate.m。您应该导入Cipher.h(注意后缀!)。

正如 HachiEthan 在评论中指出的那样,您可能已Cipher.mCaeser Shift-Prefix.pch文件中导入(在“支持文件”组中)。该文件由所有.m文件自动导入,因此它与我上面的#2 具有相同的效果。

于 2012-07-30T19:24:50.527 回答