Error LNK2019: unresolved external symbol WinMain (vs2019)

Reproduced from: (22 messages) error LNK2019: unresolved external symbol_ [email protected] (VS2013)_ Deep hidden skill and name – CSDN blog

1、 Problem description
msvcrtd.lib (crtexew. Obj): error LNK2019: unresolved external symbol  _ [email protected] , the symbol in the function___ Tmaincrtstartup is referenced
debug \ jk.exe: fatal error lnk1120: an external command that cannot be resolved

error LNK2001: unresolved external symbol  _ [email protected]
debug/main.exe:fatal error LNK 1120:1 unresolved externals
error executing link.exe;

2、 Causes and solutions
the real reason for this problem is that the C language runtime cannot find an appropriate program entry function,

In general, if it is a Windows program, WinMain is the entry function, and the new project in VS2008 is “Win32 project”

If it is a DOS console program, main is the entry function, and the new project in VS2008 is “Win32 console application”

If the entry function is not specified properly, it is obvious that the C language runtime cannot find the matching function, and it will report an error.

Modify the settings to suit your needs

If it is a Windows program:

1. Select project – & gt; Properties, the property pages window pops up

2. Select configuration properties – & gt; C/C++-> Preprocessor, and then delete it in the item corresponding to preprocessor definitions in the right column_ Console, add_ WINDOWS.

3. Select configuration properties – & gt; Linker-> System, and then change the corresponding item of subsystem in the right column to windows (/ subsystem: Windows)

If it is a console program:

1. Select project – & gt; Properties, the property pages window pops up

2. Select configuration properties – & gt; C/C++-> Preprocessor, and then delete it in the item corresponding to preprocessor definitions in the right column_ Windows, add_ CONSOLE.

3. Select configuration properties – & gt; Linker-> System, and then change the item corresponding to subsystem in the right column to console (/ subsystem: console)

Similar Posts: