Search code examples
iphoneiosgcctwittermgtwitterengine

MGTwitterEngine throws error: g++-4.2 failed with exit code 1


I installed MGTwitterEngine in my iPhone app, and followed all the instructions, and now I get the following error:

Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

The full error text is:

Ld /Users/jason/Documents/iPad/build/Debug-iphonesimulator/FlashCards.app/FlashCards normal i386
cd /Users/jason/Documents/iPad/FlashCards
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/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/jason/Documents/iPad/build/Debug-iphonesimulator -L/Users/jason/Documents/iPad/FlashCards/Classes -L/Users/jason/Documents/iPad/FlashCards/Classes/SAOAuthTwitterEngine -L/Users/jason/Documents/iPad/FlashCards/Classes -L/Users/jason/Documents/iPad/FlashCards/Classes/Simulator4 -F/Users/jason/Documents/iPad/build/Debug-iphonesimulator -filelist /Users/jason/Documents/iPad/build/FlashCards.build/Debug-iphonesimulator/FlashCards++.build/Objects-normal/i386/FlashCards.LinkFileList -mmacosx-version-min=10.6 -l teEngine -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 /Users/jason/Documents/iPad/core-plot/build/Debug-iphonesimulator/libCorePlot-CocoaTouch.a -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreData -licucore.A -framework QuartzCore -framework SystemConfiguration -framework Security -framework MessageUI -framework CFNetwork -framework AddressBook -framework AddressBookUI -framework AudioToolbox -lteEngine -lteEngine -lOAuth -lxml2.2.7.3 -o /Users/jason/Documents/iPad/build/Debug-iphonesimulator/FlashCards.app/FlashCards

ld: duplicate symbol _EstimateBas64DecodedDataSize in /Users/jason/Documents/iPad/FlashCards/Classes/SAOAuthTwitterEngine/libOAuth.a(Base64Transcoder.o) and /Users/jason/Documents/iPad/build/FlashCards.build/Debug-iphonesimulator/FlashCards++.build/Objects-normal/i386/Base64Transcoder.o
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1

Any idea what could be causing it?


Solution

  • Linker found a duplicate symbols for EstimateBas64DecodedDataSize function because in you project you are trying to link against static library libOAuth.a and Base64Transcoder.o which was built from the sources. Both of them contains this symbol and linker doesn't know which one it should pick. It's hard to tell how to resolve this issue in general case, but basically you have to make sure that this symbol is exported by exactly one file from linker's input.

    Where did you get this MGTwitterEngine distribution? It will be much easier to solve this issue with actual code.