Windows 7 (NASM を使用) で次のコードをコンパイルしようとしています。
[BITS 32]
extern ExitProcess
import ExitProcess kernel32.dll
extern MessageBoxA
import MessageBoxA user32.dll
segment .data use32
Caption db 'Caption Text',0
Text db "My MessageBox Text.",0
segment .code use32
..start:
push dword 0
push dword Caption
push dword Text
push dword 0
call [MessageBoxA]
push dword 0
call [ExitProcess]
これをコンパイルするために、試してみnasm -o test.o test.asm
ましたが、次のように表示されます。
test.asm:4: error: parser: instruction expected
test.asm:6: error: symbol `import' redefined
test.asm:6: error: parser: instruction expected
うまくいかないのはなぜですか?
編集:わかりました。単純な間違い...nasm -o test.o -f obj test.asm
うまくいく...