PRB: Wrong Project Selection Causes LNK2001 on _WinMain@16Last reviewed: August 26, 1997Article ID: Q131204 |
The information to this article applies to:
SYMPTOMSThe linker generates the following error message when a Console Application project is built as an Application project:
LIBC.lib(wincrt0.obj):error LNK2001:unresolved external symbol "_WinMain@16" CAUSEA project of type Application is a Windows-based application, so it requires the WinMain function as the entry point.
RESOLUTIONCreate a new project and select Console Application as the Project Type, or add a project to the existing Project. To Create a new target for an existing project with Visual C++ 2.x, from the Project menu, choose Targets, and select New. Enter a Target Name, and choose Win32 Console Application as the type. To build the new target, move to the project dialog box, change the Target to your new Target name, and rebuild. To add a project with Visual C++ 5.0, select Project, then Add to Project, and select New. Click on the Projects tab and select Win32 Console Application.
STATUSThis behavior is by design.
MORE INFORMATIONTo reproduce the behavior, select Application as the Project Type, and use the following sample code.
Sample Code to Demonstrate Behavior
/* Compile options needed: None */ #include <iostream.h> void main(void) { cout << "Hello " ; } |
Additional query words: 9.00 9.10 9.0 9.1
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |