Problem using C file and Cocoa classes together
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:
"___g开发者_运维问答edf2", 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.
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.
精彩评论