This article describes the VC external symbol error _MAIN,_WINMAIN@16,__BEGINTHREADEX solution. Share to everyone for your reference. Specifically as follows:
When you create an MFC project, you do not use the MFC AppWizard Wizard, and if you do not set the project parameters, many connection errors, such as Error LNK2001 errors, are generated at compile time.
Typical error tips are:
LIBCMTD.lib (crt0.obj): Error lnk2001:unresolved external symbol
_main
LIBCD.lib (wincrt0.obj): Error lnk2001:unresolved external symbol _winmain@16
Msvcrtd.lib (crtexew.obj): Error
lnk2001:unresolved external Symbol _winmain@16
Nafxcwd.lib (thrdcore.obj): Error
lnk2001:unresolved external symbol
__beginthreadex
Nafxcwd.lib (thrdcore.obj): Error lnk2001:unresolved
External symbol __endthreadex N
1. Windows subsystem Setup error, prompt:
LIBCMTD.lib (crt0.obj): Error lnk2001:unresolved
External symbol _main
You can set Windows projects to use the Windows subsystem instead of the console:
[project]–> [settings]–> Select the "Link" property page,
Change/subsystem:console to/subsystem:windows in Project options
2. Console subsystem Setup error, prompt:
LIBCD.lib (wincrt0.obj): Error lnk2001:unresolved
External symbol _winmain@16
To use the console subsystem instead of Windows, the console project sets:
[project]–> [settings]–> Select the "Link" property page,
Change/subsystem:windows to/subsystem:console in Project options
3. Program Entry settings Error,
Tips:
Msvcrtd.lib (crtexew.obj): Error lnk2001:unresolved external symbol _winmain@16
Typically, the program entry function for an MFC project is WinMain,
If you compile a Unicode version of your project, the program entry must be changed to wWinMainCRTStartup, so you need to reset the program entry:
[project]–> [settings]–> Select the "Link" property page,
Select output in category,
And then fill in the wWinMainCRTStartup in Entry-point symbol, you can
4. Thread Run-time Library Setup error, prompt:
@:
KAF N
Nafxcwd.lib (thrdcore.obj): Error lnk2001:unresolved external symbol
__beginthreadex
Nafxcwd.lib (thrdcore.obj): Error lnk2001:unresolved
External symbol __endthreadex
This is because MFC needs to change the settings when it wants to use multiple-threading libraries:
[project]–> [settings]–> Select the "C + +" property page,
Select the code Generation in category,
Then select Debug multithreaded or multithreaded in the use Run-time Library
Where, single-threaded single-threaded static link library (release version)
multithreaded multithreaded static link library (release version)
Multithreaded DLL multithreaded dynamic link library (release version)
Debug
single-threaded single-threaded static link library (Debug version)
Debug
multithreaded multithreaded static link library (Debug version)
Debug multithreaded
DLL multithreaded Dynamic link library (Debug version)
Single-threaded: Multi-Threading is not required, used in DOS environments
Multithreading: can run concurrently
Static Library: Directly link the library with the program, you can run out of the MFC library
Dynamic Library: Requires the corresponding DLL dynamic library, the program can run
Release version: Use when officially released
Debug Version: Debugging phase use
I hope this article on the VC program for everyone to help.