Macos osx上的程序集可执行文件

Macos osx上的程序集可执行文件,macos,assembly,osx-snow-leopard,nasm,Macos,Assembly,Osx Snow Leopard,Nasm,我得到了,我想把程序集编译成一个可执行文件。我不断得到错误: ld: warning: ignoring file firststart.asm, file was built for unsupported file format which is not the architecture being linked (x86_64) Undefined symbols for architecture x86_64: "_main", referenced from: star

我得到了,我想把程序集编译成一个可执行文件。我不断得到错误:

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

当我尝试用gcc编译时。我使用的是xcode附带的gcc。我做错了什么?

首先,使用nasm-f macho64 firststart.asm组装。那么,不要告诉gcc关于firststart.asm,告诉它关于firststart.o.@FrankKotler那么如果你不介意的话,我应该特别使用什么命令,在nasm-f macho64 firststart.asm之后可能是gcc-o firststart firststart.o这是一个最小值,你可能需要更多。我不熟悉OSX,但我知道ld对.asm文件的投诉不正确-f macho32并告诉gcc-m32,如果你得到的是32位代码。@FrankKotler成功了!把它记下来作为答案,我会把它当作正确的!