Take the 2-minute tour ×

This may be overkill, but I need to reproject a point coming from the CLLocationManager, which is in EPSG:4326, to Dutch RD (Double Stereographic, EPSG:28992) in my iOS application and I am using Proj4 to do it. At least that's what I set out to do. Here's what I tried:

  • I grabbed a Proj4 Xcode project from route-me and added it to my Xcode project.
  • I added a dependency on Proj4 to my build target. (Target -> Properties -> General -> Direct Dependencies -> + (add)
  • I added the path to the Proj4 project directory to my Library search paths. (Target -> Properties -> Build -> Library Search Paths)
  • I added the path to the Proj4 project directory to my Header search paths. (Target -> Properties -> Build -> Header Search Paths)
  • I added a reference to Proj4 (-lProj4) to my linker flags (Target -> Properties -> Build -> Other Linker Flags)

But I still get a linker error when compiling:

ld: library not found for -lProj4

What am I missing here?

share|improve this question
what about -lproj4 ? –  iant Mar 1 '11 at 21:51
Nope. Same problem. Thanks. –  mvexel Mar 1 '11 at 22:06
-L/path/to/lib? –  iant Mar 1 '11 at 22:25
The library path is passed by the Xcode build settings so I already have that in my linker flags. The 'Other linker flags' option is only for additional attributes that are not captured in the build settings. –  mvexel Mar 1 '11 at 22:55

2 Answers 2

up vote 2 down vote accepted

Questions to narrow things down:

1) Are you compiling proj.4 for the right architecture?

2) Is there a 'libproj4.a' or 'libproj4.so' in any of the library search folders?

3) What is the command (+ arguments) that are triggering the linker error?

And some guesses in the dark as to what might be going on, corresponding roughly to the questions above:

1) Proj4 is being built, but for OSX+x86, not IOS+ARM, and thus can't be linked.

2) It's being built, but the resulting library isn't in the library search path, possibly because it's snugged away into a subdirectory instead of directly in the project directory.

2a) It may not be named what you expect, e.g. version #s so you'd need -lProj4.01

3) Other ;)

share|improve this answer
I don't know if it has had anything to do with migrating to Xcode 4, and I am sure I checked the build target before, but after re-opening in Xcode 4, checking the build settings, and re-compiling, It Just Worked™. Your answer made me revisit this particular thing, so the bounty is yours! Edit: in another 17 hours when I actually may give it to you. –  mvexel Mar 22 '11 at 22:12
Glad it worked, no further troubleshooting required. Sweet, sweet bounty! Though since it's (mostly) unearned I'll probably stick it onto a deserving-looking question that doesn't have an answer yet. –  Dan S. Mar 22 '11 at 22:52
Great, Dan. There could be more bounties around here! It sure helped me out. –  mvexel Mar 23 '11 at 12:32

Are you sure that you need all the proj.4 code to perform such a simple task?
Grab only the projection algorithm that you need from proj.4 souce code and put it in your app.

share|improve this answer

Your Answer


