私は最初のプログラムをアセンブラでコンパイルしてリンクしようとしています。 私は次のコードをコンパイルしよう:MacOSXでnasmを使ってコンパイルする方法
-bash-3.2$ nasm -f macho main.asm -o main.o && ld -e _main -macosx_version_min 10.8 -arch x86_64 main.o
しかし、結果は次のとおりです:プログラムをコンパイルしてリンクするためのコンソールコマンド以下
; %include "stud_io.inc"
global _main
section .text
_main:
xor eax, eax
again:
; PRINT "Hello"
; PUTCHAR 10
inc eax
cmp eax, 5
jl again
を
ld: warning: ignoring file main.o, file was built for i386 which is not the architecture being linked (x86_64): main.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
-u command line option
ld: symbol(s) not found for architecture x86_64
私はその必要を考えますx86_64のmain.asmファイルをコンパイルするには 私のシステム用のプログラムを正しくコンパイルするには?
'-f macho64'おそらく? – JasonD
nasmはこのオプションを認識しません –
あなたはどのバージョンのnasmを実行していますか? – JasonD