Apple Mach-O-Linker (ID) Error - iphone

I added an existing class called RootViewController to my project I am working on now. The project compiled the first time, but the second time I tried to run it the mach-o-linker error popped up. I didn't change any code for that to happen, so I don't really know what's wrong. I know this error is usually because of a missing framework, but I'm pretty sure I included all the frameworks I need.
Here is the log:
Ld /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator/coredataproject.app/coredataproject normal i386
cd /Users/myusername/Desktop/coredataproject
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator -F/Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator -filelist /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Intermediates/coredataproject.build/Debug-iphonesimulator/coredataproject.build/Objects-normal/i386/coredataproject.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework CoreLocation -framework MapKit -o /Users/myusername/Library/Developer/Xcode/DerivedData/coredataproject-dhlbawbtzwdgohaczdnalonzhnhs/Build/Products/Debug-iphonesimulator/coredataproject.app/coredataproject
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RootViewController", referenced from:
objc-class-ref in FirstViewController.o
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have searched around for hours try to find a missing link or reference, but I don't see anything wrong.
Any help would be greatly appreciated.

I just fixed it. I copied the code out of RootViewController, deleted the .h and .m files entirely, created new files and changed the name to RootViewController and pasted the code back in. It then compiled.

Related

iPhone's Page Control Error

I tried to use this code but it doesn't work. http://developer.apple.com/library/ios/#samplecode/PageControl/Introduction/Intro.html
Ld "/Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator/Dr
Ngoo.app/Dr Ngoo" normal i386
cd /Users/waitonza/Desktop/Project/Dr-Ngoo
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
-L/Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator
-F/Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator
-filelist "/Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Intermediates/Dr
Ngoo.build/Debug-iphonesimulator/Dr Ngoo.build/Objects-normal/i386/Dr
Ngoo.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 QuartzCore -framework SystemConfiguration -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -o
"/Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator/Dr
Ngoo.app/Dr Ngoo"
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_PagingScrollViewController", referenced from:
objc-class-ref in DrNgooAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
The solution is the same as we've discussed in the comments:
I checked your project and it does not have PagingScrollViewController. You're probably referencing it from outside the folder. Add it to the project too and it should work fine!
#CodaFi also had the correct answer so +1 to him too!
The class PagingScrollViewController is not in your compile list. In the file tree, click your project at the top, then go to your target>build phases expand 'compile phase', then drag the PagingScrollViewController.m file to the list and run.

Apple mach-o linked (Id) Error

I have all the relevant frameworks added, and all relevant files are imported. In fact, if i remove the import, it gives me all the method not found errors. Any ideas how to fix this?
Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator/Journal.app/Journal normal i386
cd "/Users/Andrew/Dropbox/Developer/Dear Me/Version 1.0/XCode/Journal/Journal"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Intermediates/Journal.build/Debug-iphonesimulator/Journal.build/Objects-normal/i386/Journal.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 QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/Andrew/Library/Developer/Xcode/DerivedData/Journal-acrxfhgfvgofuyczzlzmnzunciov/Build/Products/Debug-iphonesimulator/Journal.app/Journal
Undefined symbols for architecture i386:
"_rectForRectWithInset", referenced from:
-[JButton drawRect:] in JButton.o
"_createRoundedRectForRect", referenced from:
-[JButton drawRect:] in JButton.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
EDIT:
From these lines of code:
CGRect borderRect = rectForRectWithInset(self.bounds, 0.5);
CGMutablePathRef borderPath = createRoundedRectForRect(borderRect, 4);
They reference a class with those methods in. It works in another project i have, with the same imports, the same referenced methods, the same imported framework.
a linker error most likely indicates that you missed to include a framework in your Build Phases of your target.
I don't know the implementation of the mentioned functions, but I assume, you missed to include either CoreGraphics or QuartzCore. And you need to import there main header-files.

Objective-Zip iPhone IOS 5 issue

I'm trying to use Objective-Zip on an IOS5 iPhone application and I get the following linkage error when I build my project:
----------- ***********---------------
Ld /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh normal i386
cd /Users/amirpeivandi/Documents/iPhoenApps/Zarvaragh
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/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -F/Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -filelist /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Intermediates/Zarvaragh.build/Debug-iphonesimulator/Zarvaragh.build/Objects-normal/i386/Zarvaragh.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -lz -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -o /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ZipFile", referenced from:
objc-class-ref in MainPageController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
----------- ***********---------------
I have no problem running the Objective-Zip application that comes with the code and I have checked my code, my project settings and all I could think of and the two projects (mine and default Objective-Zip iPhone project) have the same identical settings!
Any pointer would be greatly appreciated. I've been stuck for last couple of days on this silly thing. I've seen a few posts pointing to architecture supports and ARC setting but again I have two projects the way I see them identical one mine that is not compiling and one the one from Objective-Zip project that compiles and runs just fine!
Thx
Amir
Are you sure you have linked the Objective-Zip library in your project ? Because from the error it seems like it's not linked.

Undefined symbols for architecture i386 using protobuf

I'm trying to make an app that uses Protocol Buffers. I'm getting this error, any idea why?
Ld /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest normal i386
cd /Users/fmota/Documents/Developer/Protobuf/PBTest
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/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator -F/Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator -filelist /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Intermediates/PBTest.build/Debug-iphonesimulator/PBTest.build/Objects-normal/i386/PBTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework SystemConfiguration -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/fmota/Library/Developer/Xcode/DerivedData/PBTest-gvudadeakgzklbekugyiqyfyprlt/Build/Products/Debug-iphonesimulator/PBTest.app/PBTest
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AreaRequest_Builder", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Yes, this is a common problem I've seen.
Check out the answer to this nearly duplicate question and let me know if it solves the issue for you. :-)
Add *.pb.h and *.pb.m to "TARGET"->"Build Phases"->"Compile Sources"!
My working env is xcode 5.0.2.
Add *.pb.m to "TARGET"->"Build Phases"->"Compile Sources"
Do NOT add *.pb.h, after I added *.pb.h, it cannot link.

Three20 issue: _OBJC_METACLASS_$_TTURLRequestModel undefined?

Being new to iPhone development I was wanting to take it to the next level and use the Three20 library for a photo gallery I am building.
http://www.raywenderlich.com/1430/how-to-use-the-three20-photo-viewer
Everything seemed to go smoothly up to the point I tried testing the app and I got this error.
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
Ld build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery normal i386
cd /Users/company/Documents/PhotoGallery
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -L/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -F/Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator -filelist /Users/company/Documents/PhotoGallery/build/PhotoGallery.build/Debug-iphonesimulator/PhotoGallery.build/Objects-normal/i386/PhotoGallery.LinkFileList -mmacosx-version-min=10.6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework CFNetwork -framework SystemConfiguration -framework MobileCoreServices -lz.1.2.3 -framework CoreLocation -framework QuartzCore /Users/company/Documents/opensource/three20/Build/Products/Debug-iphonesimulator/libThree20.a -framework CoreData -o /Users/company/Documents/PhotoGallery/build/Debug-iphonesimulator/PhotoGallery.app/PhotoGallery
Undefined symbols:
"_OBJC_METACLASS_$_TTURLRequestModel", referenced from:
_OBJC_METACLASS_$_PhotoSet in PhotoSet.o
"_OBJC_CLASS_$_TTURLRequestModel", referenced from:
_OBJC_CLASS_$_PhotoSet in PhotoSet.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Anyone
While I included the Three20 static library I didn't include the other dependencies in the same library such as Three20UINavigator.xcodeproj etc.
Sudo was pretty close. While I did include the proper libraries it was simply that they were not activated; I don't know the proper term :P
Basically, we should keep in mind that just because I dragged the Three20.xcodeproj into my project doesn't suffice when other extensions are needed as well. Simply drag all of the xcodeproj files necessary in (wherever you are keeping three20)/three20/src/(name of particular extension)/(name of particular file).xcodeproj into your projects "group and files" Then click on each extension and select the (name of particular file).a and check the checkbox on the far right of the file preview section. This is what I didn't do for all the extensions that seemed to resolve the problem even though I had previously included them all.