Why does entry point of _start results in error when linking with GCC on Windows/MinGW?在Windows/MinGW上與GCC鏈接時,爲什麼_start的入口點會導致錯誤?
使用下面的.asm文件I彙編和鏈接使用Windows 10以下命令使用MinGW的:
nasm -f win32 helloworld.asm
gcc -e_start -o helloworld helloworld.obj
組裝工作就好了,但聯產生以下錯誤:
c:/dev/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `[email protected]'
將_start
更改爲_main
一切似乎都很好。這是爲什麼?
BITS 32
global _start
extern _printf
section .text
_start:
push msg
call _printf
add esp, 4
ret
msg:
db "HelloWorld", 10, 0
你可以顯示你的源代碼嗎? –
源代碼已在問題中。這是你看到的.asm代碼。 – Shuzheng
那你爲什麼要把它標記爲C++? –