I'm trying to assemble a simple "Hello world" application with Masm32. It assembles fine but when I try to link it, the linker says
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup prog1.exe : fatal error LNK1120: 1 unresolved externals
This is the source code of the program:
.586P
.MODEL FLAT, STDCALL
STD_OUTPUT_HANDLE equ -11
; Prototypes of external procedures
EXTERN GetStdHandle@4:NEAR
EXTERN WriteConsoleA@20:NEAR
EXTERN ExitProcess@4:NEAR
; INCLUDELIB directives for the linker
includelib c:\masm32\lib\user32.lib
includelib c:\masm32\lib\kernel32.lib
;============ data segment =================
_DATA SEGMENT
HANDL DWORD ?
BUFER DB "Hello world\n", 0
NUMB DWORD ?
NUMW DWORD ?
_DATA ENDS
_TEXT SEGMENT
MAIN:
;====== Get the output handle ======
PUSH STD_OUTPUT_HANDLE
CALL GetStdHandle@4
MOV HANDL, EAX
; Output the buffer contents to the console
PUSH 0
PUSH OFFSET NUMW
PUSH NUMB
PUSH OFFSET BUFER
PUSH HANDL
CALL WriteConsoleA@20
;Exit application
PUSH 0
CALL ExitProcess@4
_TEXT ENDS
END
I found in some forums that this is caused by the encode type. However it doesn't seem to matter to my problem