Advertisement

message box

Started by November 11, 2000 12:22 PM
11 comments, last by pizzaman 24 years, 2 months ago
i cant get my little message box to run. heres the code // DEMO2_2.CPP - a simple message box #define WIN32_LEAN_AND_MEAN #include // the main windows headers #include // a lot of cool macros // main entry point for all windows programs int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { // call message box api with NULL for parent window handle MessageBox(NULL, "THERE CAN BE ONLY ONE!!!", "MY FIRST WINDOWS PROGRAM", MB_OK | MB_ICONEXCLAMATION); // exit program return(0); } // end WinMain i am using microsoft visual c++ 6.0 and it will compile but when i execute it it says LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/demo2_2.exe : fatal error LNK1120: 1 unresolved externals can someone please help me thanks
i am the best
i got it to work
i am the best
Advertisement
Next time put your code in ''source'' brackets to its easier for us to read, please.

Just a lil'' tip

You can find info on it in the UBB link somwhere.
Easy -- you''ve selected Win32 console app instead of Win32 application... the console version needs the old Main(), whilst the latter needs a WinMain().

Hope that helps!

Simon Wilson,
XEOS Digital Development
XEOS Digital Development - Supporting the independant and OpenSource game developers!
actually no i didnt use int main() because if you look at my code it says int WINAPI WinMain, so your wrong. just so you know and no i didnt select console application.
i am the best
Geeze, calm down. He was just trying to help.

=====
Khaos
=====
Advertisement
He was not only trying to help, he was correct. Next time, think before you post.
im sorry i didnt mean to jump on you like that, but how is he right i dont really understand. i think i do have an int main and i dont make a console application. i can get it to work now though. thanks for your help guys
i am the best
You need an int main() function in a windows app? I agree with the pizza guy, because I don''t. I just use WinMain. That, and I like pizza. I''d agree with anyone who could potentially get me pizza. Mmmm. . . Pizza. Oh, sorry. I got caught up in tho moment.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
If that still isn''t working, check your link options. You might have accidentally removed a library that you need, or you''ve switched on "No Default Libraries" or something.

You could also just change your WinMain to Main. That will stop any errors.

If it still isn''t working, you''ve probably messed up your project. Scrap it and start again.

Finally, if all this should fail, throw your computer in the bin and move to a hippy commune in the mountains

Simon Wilson,
XEOS Digital Development
XEOS Digital Development - Supporting the independant and OpenSource game developers!

This topic is closed to new replies.

Advertisement