Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nujjus

macrumors newbie
Original poster
Hi!

I was wondering if anyone might know why I get the following linking errors when I try to compile and run the Apple CoreLocation sample code:


"_kCLLocationAccuracyKilometer", referenced from:
_kCLLocationAccuracyKilmoeter$non_lazy_ptr in MyLocationGetter.o


and

".objc_class_name_CLLocationManager", referened from:
literal-pointer@__OBJC@__cls_refs@CLLocationManager in MyLocationGetter.o
symbol(s) not found
collect2: ld returned 1 exit status



In my header file, I've imported <CoreLocation/CoreLocation.h> and I've declared locationManager as a class property. The class extends NSObject and conforms to CLLocationManagerDelegate.



My .m file looks like this:
Code:
#import "MyLocationGetter.h"

@implementation MyLocationGetter 

@synthesize locationManager;

- (void)startUpdates 
{ 
	// Create the location manager if this object does not 
	// already have one. 
	if (nil == locationManager) 
		locationManager = [[CLLocationManager alloc] init];		//it appears to have beef with CLLocationManager
	locationManager.delegate = self; 
	locationManager.distanceFilter = 1000; // 1 kilometer 
	locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;		//it appears to have beef with kCLLocationaccuracyKilometer
	[locationManager startUpdatingLocation]; 
}

Any help is appreciated, thanks!
 
I thought so..

my header file has both:

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>


Looking into the framework, CoreLocation has:

Code:
#ifndef __CORELOCATION__
#define __CORELOCATION__

#import <CoreLocation/CLLocation.h>
#import <CoreLocation/CLLocationManager.h>
#import <CoreLocation/CLLocationManagerDelegate.h>

#endif /* __CORELOCATION__ */

which includes what I need.
 
No you actually need to add the framework to your project. Just including the header files is not enough.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.