views:

42

answers:

1

When I recompiled an old Obj-C project (a Cocoa app), the linker couldn't find some common library modules, including sin() and sysctl(). This project had been working in the previous version of Xcode. I am now using Xcode 3.1.2 in OSX 10.5. The error message was:

Line Location Tool:0: collect2: ld returned 1 exit status  
Line Location Tool:0: symbol(s) not found  
Line Location Tool:0: _AmIBeingDebugged in MeterMileage.o  
Line Location Tool:0: "_sysctl", referenced from:  
Line Location Tool:0: -[AnimatedStar drawRect:] in AnimatedStar.o  
Line Location Tool:0: "_sin", referenced from:  
...  

My current version of Xcode will link with the correct library for a new project using sin(), etc. How do I fix the project which started in an earlier Xcode to use the correct library? I saw the post about linking in FFTW, but sin() is not so unusual, is it?

I suppose I could create a new project, and copy my code, etc into it, but that seems a little clumsy. Is there a better way? There will probably be more projects that need updating.

Thanks, Gary

A: 

It's likely that the older project is trying to explicitly link against an older copy of the C standard library or runtime that doesn't exist on 10.5. Please post the linker invocation line, not just the error results; that should give us some clues.

cdespinosa
Well, I had to do a little learning... The closest I could find to a linker invocation line was the BUILD TRANSCRIPT line for GCC. It had a "-nostdlib" flag. Ah-hah! That was the problem. Is there a way to see the actual linker invocation? That might simplify things in the future by showing only the relevant ld flags (dropping the gcc stuff). Thank you for the help.
gary