重新编译 Obj-C 项目时丢失库
当我重新编译一个旧的 Obj-C 项目(一个 Cocoa 应用程序)时,链接器找不到一些常见的库模块,包括 sin() 和 sysctl()。该项目已在以前版本的 Xcode 中运行。我现在在 OSX 10.5 中使用 Xcode 3.1.2。错误消息是:
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:
...
我当前版本的 Xcode 将使用 sin() 等链接到新项目的正确库。如何修复在早期 Xcode 中启动的项目以使用正确的库?我在 FFTW 中看到了有关链接的帖子,但是 sin() 并不是那么不寻常,不是吗?
我想我可以创建一个新项目,并将我的代码等复制到其中,但这似乎有点笨拙。有更好的办法吗?可能会有更多项目需要更新。
谢谢, 加里
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
较旧的项目可能正在尝试显式链接 10.5 上不存在的 C 标准库或运行时的较旧副本。请发布链接器调用行,而不仅仅是错误结果;这应该会给我们一些线索。
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.