Obj-class-ref error when compiling for an iPhone - iphone

Ld /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator/sampleResource.app/sampleResource normal i386
cd /Users/rajeshmedampudi/Dropbox/Work/iphone/sampleResource
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/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator -F/Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator -filelist /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Intermediates/sampleResource.build/Debug-iphonesimulator/sampleResource.build/Objects-normal/i386/sampleResource.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 UIKit -framework Foundation -framework CoreGraphics -o /Users/rajeshmedampudi/Library/Developer/Xcode/DerivedData/sampleResource-flngddqnaawregcrrshzpianssjc/Build/Products/Debug-iphonesimulator/sampleResource.app/sampleResource
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_User", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_AuthenticationViewController", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_AppHelpers", referenced from:
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)
this is the error I am getting when I try to run the file ... I have imported those classes from another project into this one which was non arc based and converted to ARC. I got this error after successfully removing all the references to autorelease and retains from it.

Did you try Product->Clean?
Or restarting XCode?
Did you make sure you've included everything in the Targets->Build Phases->Compile Sources? Xcode does this for you, but sometimes it misses things.

Related

undefined symbol for architecture i386 defacebookComposerViewController

i have added all frameworks and set my deployment target 4.3 but i don t know why i am getting this error. can any one help me what i am doing wrong?
Ld /Users/malik98b/Library/Developer/Xcode/DerivedData/intellegentQuiz-dvsvdwuxvcsnjxhacouhvetzygfd/Build/Products/Debug-iphonesimulator/intellegentQuiz.app/intellegentQuiz normal i386
cd /Users/malik98b/Desktop/intellegentQuiz
setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
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/iPhoneSimulator6.1.sdk -L/Users/malik98b/Library/Developer/Xcode/DerivedData/intellegentQuiz-dvsvdwuxvcsnjxhacouhvetzygfd/Build/Products/Debug-iphonesimulator -F/Users/malik98b/Library/Developer/Xcode/DerivedData/intellegentQuiz-dvsvdwuxvcsnjxhacouhvetzygfd/Build/Products/Debug-iphonesimulator -F/Users/malik98b/Desktop/intellegentQuiz/../../Documents/FacebookSDK -F/Users/malik98b/Desktop/intellegentQuiz/intellegentQuiz -filelist /Users/malik98b/Library/Developer/Xcode/DerivedData/intellegentQuiz-dvsvdwuxvcsnjxhacouhvetzygfd/Build/Intermediates/intellegentQuiz.build/Debug-iphonesimulator/intellegentQuiz.build/Objects-normal/i386/intellegentQuiz.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=4.3 -lz.1.2.5 -framework Security -weak_framework Social -weak_framework Accounts -framework CFNetwork -framework SystemConfiguration -framework Twitter -weak_framework AdSupport -framework MessageUI -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -framework FacebookSDK -o /Users/malik98b/Library/Developer/Xcode/DerivedData/intellegentQuiz-dvsvdwuxvcsnjxhacouhvetzygfd/Build/Products/Debug-iphonesimulator/intellegentQuiz.app/intellegentQuiz
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DEFacebookComposeViewController", referenced from:
objc-class-ref in ShareVC.o
"_OBJC_CLASS_$_DETweetComposeViewController", referenced from:
objc-class-ref in ShareVC.o
"_OBJC_CLASS_$_SHKItem", referenced from:
objc-class-ref in ShareVC.o
"_OBJC_CLASS_$_SHKMail", referenced from:
objc-class-ref in ShareVC.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Sometimes the .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target and you need to add the .m file manually.
credit to Allen pike on this one
Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

What does the error mean?

Ld /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator/Video.app/Video normal i386
cd "/Users/michaelsonsamuels/Desktop/Xcode /Video"
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
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/iPhoneSimulator6.1.sdk -L/Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator -F/Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator -filelist /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Intermediates/Video.build/Debug-iphonesimulator/Video.build/Objects-normal/i386/Video.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework StoreKit -framework AudioToolbox -framework MessageUI -framework SystemConfiguration -framework CoreGraphics -framework UIKit -framework Foundation -o /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator/Video.app/Video
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GADBannerView", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_GADRequest", referenced from:
objc-class-ref in ViewController.o
"_kGADAdSizeBanner", referenced from:
-[ViewController viewDidLoad] 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)
Ld /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator/Video.app/Video normal i386
cd "/Users/michaelsonsamuels/Desktop/Xcode /Video"
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
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/iPhoneSimulator6.1.sdk -L/Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator -F/Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator -filelist /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Intermediates/Video.build/Debug-iphonesimulator/Video.build/Objects-normal/i386/Video.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework StoreKit -framework AudioToolbox -framework MessageUI -framework SystemConfiguration -framework CoreGraphics -framework UIKit -framework Foundation -o /Users/michaelsonsamuels/Library/Developer/Xcode/DerivedData/Video-hedtrampxpseetfcmcksycqvmpuk/Build/Products/Debug-iphonesimulator/Video.app/Video
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GADBannerView", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_GADRequest", referenced from:
objc-class-ref in ViewController.o
"_kGADAdSizeBanner", referenced from:
-[ViewController viewDidLoad] 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)
"_OBJC_CLASS_$_GADBannerView", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_GADRequest", referenced from:
objc-class-ref in ViewController.o
"_kGADAdSizeBanner", referenced from:
-[ViewController viewDidLoad] 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)
Thanks.
Your classes are missing from Build target. I don't know about your project structure and files but it looks like GADBannerView and GADRequest classes are missing.
Remove these files from your project. add them again and remember to check "ADD TO TARGET" checkbox.
Add the libGoogleAdMobAds.a to the Linked Frameworks and Libraries.
this error shows that u haven't added GADBannerView, and GADRequest classes.
please check by following this steps:
in XCode select your Project in the Target Section then switch to BuildPhases->CompileSources
here check for GADBannerView.m and GADRequest.m files.
XCode->Your Project in Target section->BuildPhases->CompileSources
hope this will help you.

"Undefined symbols for architecture i386" using a static library in iOS

I'm trying to create a static library in xcode 4.2.
I'm following the steps in this tutorial. However, I get the following error:
Ld /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator/Testlib.app/Testlib normal i386
cd /Users/harishk/Desktop/sl/Testlib
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/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator -L/Users/harishk/Desktop/sl/Testlib/Testlib/lib -L/Users/harishk/Desktop/sl/Testlib/../lib -L/Users/harishk/Desktop/sl/Testlib -F/Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator -filelist /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Intermediates/Testlib.build/Debug-iphonesimulator/Testlib.build/Objects-normal/i386/Testlib.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -objC -all_load -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -lSimpleLibrary -o /Users/harishk/Library/Developer/Xcode/DerivedData/Testlib-ailufzhcoulmzrflyhfgbwqbiksx/Build/Products/Debug-iphonesimulator/Testlib.app/Testlib
ld: warning: ignoring file /Users/harishk/Desktop/sl/lib/libSimpleLibrary.a, file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MathFunctions", 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)
The MathFunctions class is missing. Either from your application project or from the SimpleLibrary.a that you use. Make sure it is part of the compilation and linking steps of your build.

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.

compile error on Xcode

How can i fix it
Ld build/Debug-iphonesimulator/iRadio.app/iRadio normal i386
cd /Users/ragopor/Desktop/iRadio
setenv MACOSX_DEPLOYMENT_TARGET 10.5
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/iPhoneSimulator3.1.2.sdk -L/Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator -F/Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator -F/Users/ragopor/Desktop/iRadio -filelist /Users/ragopor/Desktop/iRadio/build/iRadio.build/Debug-iphonesimulator/iRadio.build/Objects-normal/i386/iRadio.LinkFileList -mmacosx-version-min=10.5 -framework MediaPlayer -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/ragopor/Desktop/iRadio/build/Debug-iphonesimulator/iRadio.app/iRadio
ld: warning: in /Users/ragopor/Desktop/iRadio/MediaPlayer.framework/MediaPlayer, missing required architecture i386 in file
Undefined symbols:
".objc_class_name_MPMoviePlayerController", referenced from:
literal-pointer#__OBJC#__cls_refs#MPMoviePlayerController in iRadioAppDelegate.o
"_MPMoviePlayerContentPreloadDidFinishNotification", referenced from:
_MPMoviePlayerContentPreloadDidFinishNotification$non_lazy_ptr in iRadioAppDelegate.o
"_MPMoviePlayerScalingModeDidChangeNotification", referenced from:
_MPMoviePlayerScalingModeDidChangeNotification$non_lazy_ptr in iRadioAppDelegate.o
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
_MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in iRadioAppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Looks like you need to include the MediaFramework in your project.
I had the same issue while all frameworks and compiling sources were added. What fixed my issue was to delete ~/ProjectFolder/MediaPlayer.framework/MediaPlayer.exec file, and then build and run, and it worked!