error LNK2001: unresolved external symbol _WinMain@16

Posted on 2003-03-11
Medium Priority
Last Modified: 2007-12-19
Hello everyone,

I have this problem I don't seem to get out. I'm using VC++ 6.0 on an XP PC.
Compiling my program, existing of 3 headers and 1 cpp, I don't get any errors nor warnings.
However, when I'm trying to build I get the following :

MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
Release/Wsp.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

As a starter, I admit I have near to no knowledge of what exactly I should put as in what settings I should use for this Projects, I'm assuming I have this project changed under "Using MFC as Shared DLL"; This is an "empty" Win32 Application.
To be honest with you I don't get a lot out of what I'm doing on those Project settings yet..it's a bit too new to me. Yet I'm thinking this lack of knowledge has something to do with my error here..therefore would anyone explain me what to do and why it's acting like that?  From what I'm making out of this : the file _WinMain@16 is not available in the library MSVCRT? or should I put a library directory somewhere in those project settings? I'm completely in the dark..
Thank you in advance..

Question by:Traveldixie
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

mnashadka earned 300 total points
ID: 8115437
If it has int main() or void main() as the entry point, make sure that it uses the console subsystem.  If you use int WINAPI WinMain() as the entry point, use the windows subsystem.  I'm betting that you want the console subsystem.  To change this, go to Project->Settings->Link and change it to /subsystem:console in the Project Options box at the bottom.  Good luck.

Author Comment

ID: 8115540

I have a void main().
so if I understand this well..My choice of making a Win32 Application in the beginning of my project was wrong and should've been Win32 Console application, right?
Would you be so kind as to generally explain the difference between the two? Has it do to with GUI - preferences? Just trying to get myself an idea already..
But anyhow, thank you a lot for such quick response..it did take error away..


Expert Comment

ID: 8115680
A Win32 application by default has no window.  When you double-click it, it starts running, and has windows if it creates them (like a standard windows application - Word or Excel or whatever).  It has a predefined entry point named WinMain.  This is great if you have a backgroundA console application by default has a console window (and can also create it's own windows if needed).

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question