Search code examples
windowsassemblyx86masm32coff

"fatal error LNK1561: entry point must be defined" error from MASM32 in very simple program


Fixed; here's the fixed code (doesn't do anything and crashes, but it assembles, which is the point):

.686P
.MODEL FLAT
.CODE
_START:
    MOV al, 255
END _START

I also discovered I had to use the /c switch with ml and then link separately with /SUBSYSTEM:CONSOLE.


Just rediscovered x86 assembly and MASM32 and am getting myself reacquainted with the basics. I wrote a short, pointless program thus, to see if I could assemble anything:

.686P
.MODEL FLAT
.CODE
START:
    MOV al, 255
END

I ran ml /coff test.asm and got this output:

Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: test.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

"test.obj"
"/OUT:test.exe"
LINK : fatal error LNK1561: entry point must be defined

I read online that START was the name of the entry point. Have I done this wrong or this is a different problem?

Thanks in advance!


Solution

  • I don't have MASM, but usually the entry point is _start:, not START:.

    See this MASM example program.