2012-05-23 65 views
1

我刚刚编译nasm一个assembley文件是这样的:NASM和gcc:32位链接失败(64位Mac OS X)

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

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

$ gcc -m32 somefile.o -o someprogramm 

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

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 
+0

你可以发布somefile.asm –

回答

1

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

1

您遇到的问题是您正在创建与Mac OS X对象格式不兼容的32位Linux(ELF)目标文件。尝试将'-f elf'切换为'-f macho32'。