nasm和gcc:32位连接失败(64位Mac OS X) [英] nasm and gcc: 32 bit linking failed (64 bit Mac OS X)

查看:217
本文介绍了nasm和gcc:32位连接失败(64位Mac OS X)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚用这种方式编译了一个带有 nasm 的汇编文件:

I've just compiled a assembley file with nasm this way:

$ nasm -f elf somefile.asm -o somefile.o

之后,我想将 somefile.o 链接到 gcc

$ gcc -m32 somefile.o -o someprogramm

但链接该文件打印出以下错误:

But linking the file prints the following error:

ld: warning: ignoring file somefile.o, file was built for unsupported file format which is 
not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_main", referenced from:
     start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status


推荐答案

经过一段时间,我决定对这类程序使用 Linux ,因为它具有更大的灵活性。您可以在虚拟机上使用Linux,如 Virtual Box

After a time I decided to use Linux for this kind of programms, because it has more flexibility. You can use Linux on a virtual machine like Virtual Box.

这篇关于nasm和gcc:32位连接失败(64位Mac OS X)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆