2011-08-18 72 views
7

我有以下錯誤:蘋果Mach-O的鏈接(ID)錯誤

ld /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText normal i386 
    cd "/Volumes/Data/Documents/XCode Projects/Trans SMS" 
    setenv MACOSX_DEPLOYMENT_TARGET 10.6 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -F/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -filelist /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/uniText.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework SystemConfiguration -framework MessageUI -framework AddressBook -framework AddressBookUI -framework CoreTelephony -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText 

ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath in /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o and /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o for architecture i386 
collect2: ld returned 1 exit status 
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 

有人能幫助我嗎? 它以前正常工作。 我不知道我在項目源中發生了什麼變化。 但我相信我從來沒有改變FMDatabase.h和.m中的任何內容。

回答

4

您的錯誤的相關部分是ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath。由於某些原因,鏈接器(ld)試圖鏈接FMDatabase兩次。檢查您的項目中是否有多個副本。

+0

我認爲你的回答非常合理。但是如果我檢查項目,我只有這些.h和.m文件的一個副本。 FMDatabase.h和FMDatabase.m。我應該再次尋找什麼? –

+0

這也幫助我解決了問題 - 謝謝。只需雙引用一個文件即可。 –

+1

你是什麼意思的雙引用?幫幫我!!!如何檢查我是否有文件的雙引用? – OMGPOP

1

檢查是否導入需要的框架。

4

我在我的.h文件中將值初始化爲全局範圍中定義的常量時,有一次出現此錯誤。

通過在標題中聲明它們並在.m文件中初始化它們來解決問題。

+1

哇。這是我正在尋找的答案! – OMGPOP

+0

使用宏的另一個原因! –

3

這是一個相當古老的帖子,但也許它仍然有助於某人。

剛剛有同樣的問題,對我來說,解決方案是:我偶然將一個.m文件鏈接到一個頭文件中,而不是.h文件。只是將其改爲正確鏈接.h文件。

0

我通過更新框架來解決問題。

0

我通過執行Clean來解決。

然後可以建立。

相關問題