我正在尝试在 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
有效...