Wooo
<div class="IPBDescription">C++ Problems</div> Okay, my compiler won't compile a simple program I made to make a Windows message box appear.
<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
MessageBox(NULL,
"GASP",
"Message Box",
MB_OK);
return 0;
}<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
That's the linker error I get. Someone wanna tell me what that means and how I get rid of it?
MSVC++ 6
<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
MessageBox(NULL,
"GASP",
"Message Box",
MB_OK);
return 0;
}<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
That's the linker error I get. Someone wanna tell me what that means and how I get rid of it?
MSVC++ 6
Comments
Well, now I feel smart.
Hey, at least I wasted peoples time. :\
Er... so thats how you do pause and clear screen? I've yet to see anything that told me that <!--emo&???--><img src='http://www.unknownworlds.com/forums/html//emoticons/confused.gif' border='0' style='vertical-align:middle' alt='confused.gif' /><!--endemo-->
pause and clear allow you to give the illusion of a smooth transition. If you enter in something and hit enter, the screen can immediately switch to something else. In my opinion, the capabilities of a program are more important than the interphase. Especially if you're the only one using.
...
Believe it or not, you can actually invoke message boxes from a console application. You can #include <windows.h>, have your main as a normal int main, and in your code have a call to MessageBox. It'll work.
Mind you, you do need to make it a windows app if you intend to, well, make windows with it.
...
Avoid using std::system() unless you really have to. The idea is that they make your code less portable; in this case it doesn't make any difference because you're never going to run your code on anything other than your machine, but it's not good practise to get into using platform-specific code without having made provision for it.
It sounds like you have got you're missing your MS libraries in the link.