PDA

Click to See Complete Forum and Search --> : uh...what error is this?


SteveCRM
Nov 14th, 2000, 08:40 PM
This works fine in borland...but I get this in ms:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Guess My Number.exe : fatal error LNK1120: 1 unresolved externals

here is the code

#include <iostream.h>

int number;
int guess;
int dummy;

int main()
{
//until i randomize NUMBER then its just going to be 34
number=34;

cout<<"Welcome To High Low!"<<endl;
cout<<"===================="<<endl;
cout<<"Enter a number between 1 and 100!"<<endl;
cin>>guess;

// if guess<number then it says too low, else it says too high, or if
// you get it, it says congrats
while (guess!=999)
{
if(guess<number)
{
cout<<"Too low! Guess again."<<endl;
cin>>guess;
}
else if(guess>number)
{
cout<<"Too high! Guess again."<<endl;
cin>>guess;
}
else if(guess==number)
{
cout<<"Congratulations! You Win!";
guess = 999;
}
}
//END OF WHILE STATEMENT

cin >> dummy;
return 0;
}

I know, Im a beginner...by the way, it would help me out a lot if you could also tell me how to make random numbers. But whats wrong?!?!?! Borland says its fine... :(

HarryW
Nov 14th, 2000, 09:09 PM
I think you may have created your project as a Win32 Application. Try creating a Win32 Console Application, if you haven't already.

It's looking for WinMain(), the starting point of a Windows application. Obviously, your project has a main() instead, and that's where the error is coming from :)

SteveCRM
Nov 15th, 2000, 08:00 PM
wow...never even thought of that...thanks harry! :D