简体   繁体   English

如何在64位OSX上编译GCC 32位应用程序

[英]How to compile gcc 32bit app on 64bit osx

i try to compile a 32 bit app on my mac osx 64bit 我尝试在Mac OS X 64位上编译32位应用

I have a 32bit lib included. 我有一个32位库。

I try to create a personal lib 我尝试创建一个个人库

 gcc -m32 -c fileA.c -Iinclude -o fileA.o gcc -m32 -c fileB.c -Iinclude -o fileB.o 

All Ok 一切都好

now I create .a File 现在我创建一个文件

 ar ruv ./lib/myLib.a fileA.o fileB.o 

When I try to launch 当我尝试发射

 gcc -m32 -o imageMod imageMod.c -Iinclude -Llib 

I receive the following error 我收到以下错误

Undefined symbols for architecture i386: "_addozzo", referenced from: _main in imageMod-nfyyGP.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 架构i386的未定义符号:“ _ addozzo”,引用自:imageMod-nfyyGP.o中的_main ld:架构i386 lang未找到符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)

anyone can help me? 有人可以帮助我吗?

您需要告诉gcc链接到库中:

gcc -m32 -o imageMod imageMod.c -Iinclude -Llib -l:myLib.a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM