Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3595
  • Last Modified:

error LNK2001: unresolved external symbol _WinMain@16

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 :


Linking...
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..

Dixie
0
Traveldixie
Asked:
Traveldixie
  • 2
1 Solution
 
mnashadkaCommented:
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.
0
 
TraveldixieAuthor Commented:

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..

0
 
mnashadkaCommented:
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).
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now