一起使用 C 文件和 Cocoa 类时出现问题

发布于 2024-10-30 16:23:41 字数 1111 浏览 2 评论 0原文

我已将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡忘如思 2024-11-06 16:23:41

仔细阅读错误消息(强调我的):

ld:警告:在 /Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/libgcc.a 中,文件是为不支持的文件格式,不是正在链接的架构 (x86_64)

看起来您正在以某种方式混合 PowerPC 和 Intel 库。您正在针对 x86_64 进行编译,但您正在为 PowerPC 选择一个 libgcc.a

那些带有所有前导下划线的符号可能应该来自 libgcc.a 但您没有链接 libgcc.a 的 x86_64 版本,因此它们在操作中丢失混乱随之而来。听起来你的 xcode 配置中的某些内容很混乱。

Read the error message carefully (emphasis mine):

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)

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 of libgcc.a so they're missing in action and chaos ensues. Sounds like something in your xcode configuration is confused.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文