link.exe unresolved external symbol _mainCRTStartup

66 Views Asked by At

All I want to do is get a simple .exe that does nothing without any external libraries. I have the simplest nasm program in the world:

global main
section .text
main:
    nop

I compile it like this:

nasm -f coff -o program.o program.asm

Then, when I try to link it with LINK.EXE, it results in the following error:

link program.o
Microsoft (R) Incremental Linker Version 14.29.30154.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : error LNK2001: unresolved external symbol _mainCRTStartup
program.exe : fatal error LNK1120: 1 unresolved externals

Why is it doing this?!? I'm not referencing anything called _mainCRTStartup

Also, this code compiled succesfuly earlier. Then, afeter trying to link a windows program, it started failing.

0

There are 0 best solutions below