Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined symbols error in Xcode 4.0.1 concerning CoreLocation framework

Tags:

ios4

I'm working through the first Core Data tutorial, "Locations". I've completed the first part of the tutorial, which sets up the NavigationController and TableViewController as well as adding CoreLocation calls to the delegate. When I build/run, I get the following error:

Ld /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator/Locations.app/Locations normal i386
cd /Users/parradoxx/Projects/Locations
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/Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator -F/Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator -F/Users/parradoxx/Projects/Locations -filelist /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Intermediates/Locations.build/Debug-iphonesimulator/Locations.build/Objects-normal/i386/Locations.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework CoreLocation -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o /Users/parradoxx/Library/Developer/Xcode/DerivedData/Locations-dbbkuqswxbvwszevbplxgtcndmeo/Build/Products/Debug-iphonesimulator/Locations.app/Locations

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in RootViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

I've read similar posts about needing to link the CoreLocation framework, and I have -- to the best of my knowledge. In fact, it was in the Frameworks directory twice for awhile. However, I suspect its a linker problem, and this gets over my head. Where I see the confusion are the references to MACOS when this is targeted for iOS.

I've been using Xcode 4 successfully since it became available. This is my first hiccup with XCode and it does leave me a bit lost. I'm happy to provide further information as requested.

like image 613
Bret Greenwood Avatar asked May 31 '11 23:05

Bret Greenwood


People also ask

How do I fix undefined symbol in XCode?

The error Undefined symbols for architecture arm64: "_OBJC_CLASS_$_SKAdImpression" during the iOS build usually happens if XCode or CocoaPods version is lower than required. To fix it update XCode to 12.5 or higher and CocoaPods to 1.10. 0 or higher.

What does undefined symbol mean in XCode?

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_xxx", referenced from: objc-class-ref in yyy.o. This generally means, you are calling "xxx" (it may be a framework or class) from the class "yyy". The compiler can not locate the "xxx" so this error occurs.

What is an undefined symbol?

A symbol remains undefined when a symbol reference in a relocatable object is never matched to a symbol definition. Similarly, if a shared object is used to create a dynamic executable and leaves an unresolved symbol definition, an undefined symbol error results.

What is undefined symbols for architecture x86_64?

Why Is the Undefined Symbols for Architecture x86_64: Error Happening? This error is happening due to the lack of included values inside the declared statements in your code. The browser is going to render the information incorrectly and show this error, especially if you are working with Main and Similarity tools.


1 Answers

Linking to the CoreLocation.framework is easy. In XCode4, click on your project icon in the top of the left column (project navigator) to look up the Build Phases in the main area. Below the Build Phases tab, expand the Link Binary With Libraries tab. Click on the + sign to pick the CoreLocation.framework from a list. That's it!

like image 127
Leonardo Borsten Avatar answered Oct 02 '22 16:10

Leonardo Borsten