Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Mach-O Linker (id) Error

Tags:

ios

xcode4

I have an error below:

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

Could someone help me out? It used to work properly before. I have no idea what I have changed in the project sources. But I am sure that I never changed anything in that FMDatabase.h and .m.

like image 463
Joshua Son Avatar asked Aug 18 '11 12:08

Joshua Son


4 Answers

The relevant portion of your error is ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath. For some reason, the linker (ld) is trying to link FMDatabase twice. Check to see if you have multiple copies of it in your project.

like image 102
lemnar Avatar answered Sep 29 '22 02:09

lemnar


I once got this error when I was initializing values to constants defined in the global scope in my .h file.

Solved the problem, by declaring them in the header, and initializing them in the .m file.

like image 33
toujamaru Avatar answered Sep 29 '22 02:09

toujamaru


This is a quite old post, but maybe it still helps somebody.

Just had the same problem, for me the solution was: I accidently linked an .m file in one of the headers instead of the .h file. Just changed that to properly link the .h file.

like image 37
dakami Avatar answered Sep 29 '22 02:09

dakami


Check if you import framework which required.

like image 33
Yanis Avatar answered Sep 29 '22 01:09

Yanis