Msvcrtd. Lib (crtexe. OBJ): Error lnk2019: the external symbol _ main that cannot be parsed. This symbol is in the function ___ tmaincrtstart

Source: Internet
Author: User
During programming, I often encounter the error "an external symbol that cannot be parsed _ main, which is referenced in the function ___ tmaincrtstartup". I recently read some books on this issue, the solution is briefly described as follows:

When the connection program is responsible for connecting to the executable program, select the corresponding C/C ++ runtime to start the function. If/subsystem is set: Windows Connection Program switch, the Connection Program will try to find the winmain or wwinmain function. If a function does not exist, an "unresolved external symbol" is returned (the external symbol _ main that cannot be parsed is referenced in the ___ tmaincrtstartup function)

Similarly, if the/subsystem: console connection PROGRAM switch is set, the Connection Program will try to find the main function or wmain function. If the connection function is not found, the Connection Program returns the unresolved externel symbol error message.

An easy mistake for new users is that the wrong application type is selected when an application is created. For example, a developer creates a new Win32 Application project and creates an entry function main for the project. In this case, when creating an application, the developer will see an error message about the Connection Program. This is because/subsystem: Windows Connection Program switch is set in the Win32 Application project, but the corresponding winmain or wwinmain function cannot be found. You can have the following solutions.

1. Change the main function to the winmain function.

2 Change/subsystem: Windows switch to/subsytem: Console

3 Delete All/subsytem: The Windows switch enables the Connection Program to perform correct operations based on the functions implemented in the source code.

How to change/subsystem: Windows:

Right-click a project and choose properties. The properties page is displayed;



Next, click "connector"> "system". The "subsystem" option is displayed on the right. You can select the corresponding connection PROGRAM switch here.

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.