• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 879
  • Last Modified:

First Program in .Net error LNK2019


I am running my first program in .NET on a new computer with .NET just installed.  I am using Visual C++ .NET Step-By-Step.  I am writing the first program, very basic!!

my program:

#include <iostream>
using namespace std;

int main()
      cout <<"Hello, World!" <<endl;
      return 0;

my error:
LIBCD.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup

I think it has to do something with with a registered library, not sure.

Please help!!

Thanks in advance!

1 Solution
Create new project of type "Win32 Console Application". Your project has another type, and linker tries to find WinMain function and not main function.
See also: /SUBSYSTEM linker option. You need /SUBSYSTEM:CONSOLE and not /SUBSYSTEM:WINDOWS.
sporenzaAuthor Commented:
Yes you are correct.  I think I may have drunk too much wine!

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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