一起使用 C 文件和 Cocoa 类时出现问题
我已将 ffmpeg 和 SDL 库导入到我的 Cocoa 应用程序的 Xcode 项目中。 当我的项目仅包含 Cocoa 类时,我的项目使用这些库成功构建并运行,但是当我在项目中包含 C 文件时,构建失败,并出现一个警告和 35 个错误:
警告是:
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/libgcc.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
错误:
"___gedf2", referenced from:
_eval_expr in libavcodec.a(eval.o)
_quantize_lpc_coefs in libavcodec.a(lpc.o)
_rc_2pass2_before in libxvidcore.a(plugin_2pass2.o)
"___ledf2", referenced from:
_qp2bits in libavcodec.a(ratecontrol.o)
_get_qscale in libavcodec.a(ratecontrol.o)
"___umodsi3", referenced from:
_vorbis_parse_setup_hdr_codebooks in libavcodec.a(vorbis_dec.o)
_vorbis_parse_setup_hdr_codebooks in libavcodec.a(vorbis_dec.o)
对于运行代码,这些是配置设置:
- 活动架构:x86_64
- 项目设置中的架构:标准(32/64 位通用)
- Mac OS X 版本:10.6.3
- Xcode 版本:3.2.3
此外,相同的代码正在使用相同的命令成功构建和运行我的另一个系统 Mac Mini 上的设置。
如果有人知道我缺少什么,请帮忙。谢谢。
I have imported the ffmpeg and SDL libraries into my Xcode project for a Cocoa application.
My project builds and runs successfully with these libraries when my project contains only Cocoa classes, but when I include a C file in my project, the build fails with one warning and 35 errors:
The warning is:
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/libgcc.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
and the errors:
"___gedf2", referenced from:
_eval_expr in libavcodec.a(eval.o)
_quantize_lpc_coefs in libavcodec.a(lpc.o)
_rc_2pass2_before in libxvidcore.a(plugin_2pass2.o)
"___ledf2", referenced from:
_qp2bits in libavcodec.a(ratecontrol.o)
_get_qscale in libavcodec.a(ratecontrol.o)
"___umodsi3", referenced from:
_vorbis_parse_setup_hdr_codebooks in libavcodec.a(vorbis_dec.o)
_vorbis_parse_setup_hdr_codebooks in libavcodec.a(vorbis_dec.o)
For running the code, these are the configuration settings:
- Active architecture: x86_64
- Architecture in project setting: Standard (32/64_bit universal)
- Mac OS X version: 10.6.3
- Xcode version: 3.2.3
Also, the same code is building and running successfully with the same settings on my other system, a Mac Mini.
If anyone has any idea what I am missing then please help. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仔细阅读错误消息(强调我的):
看起来您正在以某种方式混合 PowerPC 和 Intel 库。您正在针对 x86_64 进行编译,但您正在为 PowerPC 选择一个
libgcc.a
。那些带有所有前导下划线的符号可能应该来自
libgcc.a
但您没有链接libgcc.a
的 x86_64 版本,因此它们在操作中丢失混乱随之而来。听起来你的 xcode 配置中的某些内容很混乱。Read the error message carefully (emphasis mine):
Looks like you're mixing PowerPC and Intel libraries somehow. You're compiling for x86_64 but you're picking up a
libgcc.a
for PowerPC.Those symbols with all the leading underscores are probably supposed to come from
libgcc.a
but you're not linking the x86_64 version oflibgcc.a
so they're missing in action and chaos ensues. Sounds like something in your xcode configuration is confused.