-
Code:
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Random.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
heres my code:
Code:
#include <iostream.h>
class AGE {
public:
void showage();
void setage(int eAge);
protected:
int age;
};
void AGE::showage() {
cout<<age;
}
void AGE::setage(int eAge) {
age=eAge;
}
int main()
{
AGE steve;
int iage;
cin>>iage;
steve.setage(iage);
steve.showage();
int dummy;
cin>>dummy;
return 0;
}
I'm stumped.
-
Notice the error mentions "unresolved external WinMain"? It's looking for a function called WinMain() but it can't find one. Why would it do that? Because your project is a Win32 application, not a Win32 console application, that's why. Similarly, if you get "unresolved external _main" or something like that, it's usually because your project is a console app and you're writing Windows code (Windows apps start at WinMain(), not main() ).
-
sorry must have pushed the wrong button :p