XCode 4: Duplicating a target to make an iPad build link error

25 March 2011

I've been working on an iOS game for a four months now and it's time to create a new target for iPad. The XCode documentation says to select your target, right click and select Duplicate and the Click Duplicate and Transition to iPad. Once this is done there is a shiny new Scheme to build, test and deploy for iPad complete with a new MainWindow.xib.

When it came to linking though I got this error:

Ld /Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Products/Debug-iphonesimulator/Stranded-iPad.app/Stranded-iPad normal i386    cd /Volumes/Rayd/dazza/work/eunit/trunk/games/Stranded    
setenv MACOSX_DEPLOYMENT_TARGET 10.6    
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/local/bin:/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Products/Debug-iphonesimulator -L"/Volumes/Rayd/dazza/work/eunit/trunk/games/Stranded" -F/Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Products/Debug-iphonesimulator -F"/Volumes/Rayd/dazza/work/eunit/trunk/games/Stranded" -filelist /Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Intermediates/Stranded.build/Debug-iphonesimulator/Stranded-iPad.build/Objects-normal/i386/Stranded-iPad.LinkFileList -mmacosx-version-min=10.6 -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework MobileCoreServices -framework SystemConfiguration -lIOiOS -lalutiOS -ljpegiOS -lpngiOS -lvorbisiOS /Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Products/Debug-iphonesimulator/libiOSEngine.a -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework AVFoundation -framework MediaPlayer -framework OpenAL -lxml2 -framework AddressBook -framework AddressBookUI -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework MapKit -framework Security -lsqlite3.0 -lz.1.2.3 -weak_framework GameKit -framework AudioToolbox -framework OpenFeint -o /Users/dazza/Library/Developer/Xcode/DerivedData/Stranded-dclfeecblhgxgndqkeycujrcvisr/Build/Products/Debug-iphonesimulator/Stranded-iPad.app/Stranded-iPad ld: warning: directory not found for option '-L"/Volumes/Rayd/dazza/work/eunit/trunk/games/Stranded"'
ld: warning: directory not found for option '-F"/Volumes/Rayd/dazza/work/eunit/trunk/games/Stranded"''
ld: framework not found OpenFeintcollect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1

The error says that it can find the directory that I've added to it's search path when looking for libs (-L) and frameworld (-F). That's weird because they are there. Closer inspection of the Build Settings of the new target reveal a small error:

The simple solution was to edit \"$(SRCROOT)"\" changing it to $(SRCROOT) for both Library Search Paths and Header Search Paths and all was well.

© Copyright Execution Unit Ltd 2012