LNK2019 Error

Hey guys when I try to build this program I am getting an LNK2019 error, the full error is:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>D:\cmpsci122\solution labs\Debug\LinkedList.exe : fatal error LNK1120: 1 unresolved externals

I can't figure out where I'm going wrong and could use a fresh set of eyes

//main.cpp - Linked List test program


#define MAX_SIZE 5

using namespace std;

void main()
//Declare list
list<string> myList;

//Declare string
string myString;

cout<< "Insert Names";

for(int i = 0; i < MAX_SIZE; i++)
cin>> myString;

// pos is an iterator for myList
for ( list<string>::iterator pos = myList.begin(); pos != myList.end(); pos++ )
// Retrieve current element by dereferencing pos
string currentValue = *pos;
if(myString < currentValue)
myList.insert(pos, myString);
pos = myList.end();

for ( list<string>::iterator spot = myList.begin(); spot != myList.end(); spot++ )
cout<< *spot << endl;

closed account (zb0S216C)
You're trying to build a Windows GUI application ("int WinMain( )") and not a console application ("int main( )"). What you need to do is follow the instructions in this link: http://msdn.microsoft.com/en-us/library/ms235629.aspx

Last edited on
that's weird I do that for every program I write, at least for school, I must have messed it up somehow I'll just reset it thanks a lot
Topic archived. No new replies allowed.