Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 606295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:14:21+00:00 2026-05-13T17:14:21+00:00

I added a category to CLLocation in CoreLocation but kept getting a link error.

  • 0

I added a category to CLLocation in CoreLocation but kept getting a link error.
I search around and through process of TRY IT AND BE DAMNED I fixed the problem by adding
-framework CoreLocation to Other Linker Flags
But dont know why?
I’m guessing its something to do with CoreLocation being and external framework.

The Code:
CLLocation+DistanceComparison.h

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

static CLLocation * referenceLocation;
@interface CLLocation (DistanceComparison)
- (NSComparisonResult) compareToLocation:(CLLocation *)other;
@end

CLLocation+DistanceComparison.m

#import "CLLocation+DistanceComparison.h"
#import <CoreLocation/CoreLocation.h>
@implementation CLLocation (DistanceComparison)
- (NSComparisonResult) compareToLocation:(CLLocation *)other {
    CLLocationDistance thisDistance = [self getDistanceFrom:referenceLocation];
    CLLocationDistance thatDistance = [other getDistanceFrom:referenceLocation];
    if (thisDistance < thatDistance) { return NSOrderedAscending; }
    if (thisDistance > thatDistance) { return NSOrderedDescending; }
     return NSOrderedSame;
    }
@end

Build Error:

 Ld build/Debug-iphonesimulator/SortedLocations.app/SortedLocations normal i386  
 cd /Users/clearbrian/Documents/Development/IPhoneDevelopment/034.SortedLocations/SortedLocations  
 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.2.sdk -L/Users/clearbrian/Documents/Development/IPhoneDevelopment/034.SortedLocations/SortedLocations/build/Debug-iphonesimulator -F/Users/clearbrian/Documents/Development/IPhoneDevelopment/034.SortedLocations/SortedLocations/build/Debug-iphonesimulator -filelist /Users/clearbrian/Documents/Development/IPhoneDevelopment/034.SortedLocations/SortedLocations/build/SortedLocations.build/Debug-iphonesimulator/SortedLocations.build/Objects-normal/i386/SortedLocations.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/clearbrian/Documents/Development/IPhoneDevelopment/034.SortedLocations/SortedLocations/build/Debug-iphonesimulator/SortedLocations.app/SortedLocations  

 Undefined symbols:  
 ".objc_class_name_CLLocation", referenced from:  
 literal-pointer@__OBJC@__cls_refs@CLLocation in RootViewController.o  
 ld: symbol(s) not found  
 collect2: ld returned 1 exit status  

Getting link error when we added category
maybe because its external framework

got help from
hg clone https://traillocation.googlecode.com/hg/ traillocation
They added Foundation in Other Linker Flags for one of their targets
so I tried adding CoreLocation see attempt 2

ATTEMPT 1 : didnt work – see attempt 2

NOTE: to use this category on the 3.0 device, the -all_load linker flag
must be set in users of this library due to a toolkit bug.
See Categories in static library for iPhone device 3.0

Right Click on project name in Groups and Files pane
Get Info
Build tab
type Other Linker Flags in search
when found
Double click in right column
add -all_load

ATTEMPT 2 –
Right Click on project name in Groups and Files pane
Get Info
Build tab
type Other Linker Flags in search
when found
Double click in right column
add -framework CoreLocation
close
if you reopen the params are on two lines, this is ok
-framework
CoreLocation
Clean all targets
Build
seemed to work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:14:22+00:00Added an answer on May 13, 2026 at 5:14 pm

    Most likely you didn’t include the CoreLocation framework in your “Link binary with libraries” phase of your target. To do so, double click your target, go to the first tab, hit the + button in the bottom left, find the CoreLocation framework in the list, and hit “Add”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a category to AVAudioPlayer but I keep getting the error
I have added a category |Home| however when hitting the link it redirects to
I added an event handler to the WebClient's DownloadProgressChanged event, but it never seems
Vim is installed at /usr/share/vim. All snipMate 's folders were added to this category
i have 4 posts belonging to news category. I've added a this code in
I added a category to UIView to hold some transition helper methods. The methods
I added a category to NSArray with a helper method for sorting. My unit
I have added a category to my Xcode project using File > New >
Category methods added to specific class doesn't work at its subclass. For me, I'm
These are the steps i followed : I created a category and added product

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.