Correctly handle the Link error of unresolved external symbol _ main.

Source: Internet
Author: User

Solve the external symbol error: _ main, _ winmain @ 16 ,__ beginthreadex zteas AK &
When you create an MFC project, you do not use the MFC Appwizard wizard. If you do not have the pomelo coal Meng xiaokan question? Many connection errors will be generated during compilation, such as error lnk2001. Typical error prompts include :\"/? 8l m
Libcmtd. Lib (crt0.obj): Error lnk2001: unresolved external symbol _ main wi % * z % "bqg
Libcd. Lib (wincrt0.obj): Error lnk2001: unresolved external symbol _ winmain @ 16 C4 (dsm6n?
Msvcrtd. Lib (crtexew. OBJ): Error lnk2001: unresolved external symbol _ winmain @ 16 _ yy u 7G
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ beginthreadex M 9 $ t' p! L $
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ endthreadex mo' <"3
N q'ym
1. Windows subsystem setup error, prompt:] 9 I & X
Libcmtd. Lib (crt0.obj): Error lnk2001: unresolved external symbol _ main cc1czz ("
Pc_sv_o \
For Windows projects, you must use the Windows subsystem instead of the console. You can set it as follows: Ku A7 ^ [^ g
Qv6 =) Z
[Project] --> [settings] --> select the "Link" property page, ieny <xH 2 @
Change/subsystem: console to/subsystem: Windows so8 C h $6 in project options.
A? B) e +
2. the console subsystem settings are incorrect. The prompt is crz7tf #\.
Libcd. Lib (wincrt0.obj): Error lnk2001: unresolved external symbol _ winmain @ 16> K) d $ F
B t @ x \
For a console project, use the console subsystem instead of windows. Set: 8 ijasw.
W ~ X5 &(~
[Project] --> [settings] --> select "Link", p! D PS BK1
Change/subsystem: Windows to/subsystem: Console 3 8hxl.] Z in project options.
] \ *) LV
3. The program entry settings are incorrect. The prompt is <2nw @ 'o
Msvcrtd. Lib (crtexew. OBJ): Error lnk2001: unresolved external symbol _ winmain @ 16 VI 9O AAV
C * 91 W. mwj
Generally, the program entry function of the MFC project is winmain. If the Unicode version of the project is compiled, the program entry must be changed to wwinmaincrtstartup. Therefore, you need to reset the program entry: o % zvb9p.
{FX </DB-+
[Project] --> [settings] --> select the "Link" property page, O1 @ $ pm/F
In category, select output, B, % gqa6
Enter wwinmaincrtstartup in entry-point symbol to R; a} 1f4t!
C} H 8e [~
4. The library settings are incorrect when the thread is running. The prompt is :! R. U 3 @
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ beginthreadex ^ wjv = [-M"
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ endthreadex * \ c! 4fkm5
Ytj2t + 3-
This is because when MFC uses a multi-thread library, you need to change the settings: 6 v I = 7b/
C I @ Wow :/
[Project] --> [settings] --> select "C/C ++", l8 S/} H
In category, select code generation, L? Aemv/
Then select debug multithreaded or multithreaded {fo 9y xv0 in use run-time library.
Xianyu youxia (75374355) 12:11:11 w-6} EIL
Where,> l B: F = u
Single-threaded single-thread static link library (release version) xgnqzj 'n'
Multithreaded multi-thread static link library (release version)> 9 $ &, 6 \
Multithreaded DLL multi-thread dynamic link library (release version)> Z + M 8 (
Debug single-threaded single-thread static link library (debug version) {Ca @ y I: B
Debug multithreaded multi-thread static link library (debug version) S & F \ Q, E6 &)
Debug multithreaded DLL multi-thread dynamic link library (debug version) I, 94
\ 3 | CHN Q
Single thread: T9 f4vx +
Multithreading: concurrent running of S/% dxp &
Static Library: link the library and program directly, and run c r 1 #4o4 from the MFC Library
Dynamic library: The corresponding DLL dynamic library is required for the program to run I D!> 9 3 @ Y
Release Version: lqmjbq is used for official release! 0ai
Debug version: used during debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.