1

私が書いた単純なプログラム (暗号) をコンパイルしようとすると、次のエラーが発生します。シンボル _OBJC_METACLASS_$_Cipher が重複していることは理解していますが、何が原因なのかわかりません。誤って 2 回インポートしたかどうかを確認しようとしましたが、すべて問題ありませんでした。どんな助けでも大歓迎です!:)

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

このエラーには、次の 2 つの理由が考えられます。

  1. @implementation Cipherヘッダー ファイル (おそらくヘッダー ファイル) を挿入し、そのヘッダー ファイルを と の両方にCipher.hインポートしました。ステートメントは、ファイルではなくファイルに入ります。CaesarShiftViewController.mCaesarShiftAppDelegate.m@implementation.m.h

  2. Cipher.mと の両方CaesarShiftViewController.mに誤ってインポートしましたCaesarShiftAppDelegate.m。インポートすることになっていましたCipher.h(接尾辞に注意してください!)。

HachiEthan がコメントで指摘したように、ファイル (「Supporting Files」グループ) にインポートCipher.mした可能性があります。Caeser Shift-Prefix.pchこのファイルはすべてのファイルによって自動的にインポートされる.mため、上記の #2 と同じ効果があります。

于 2012-07-30T19:24:50.527 に答える