Jump to content
  • Advertisement
Sign in to follow this  
toejam2000

Visual Studio .NET doesnt like this code. How do I fix it?

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The following code gives me errors when Using Visual Studio .NET Any ideas? #define WIN32_LEAN_AND_MEAN #include <windows.h> //the main entry point of the program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { //show simple message box with text "Hello World!" MessageBox(NULL, "Hello World", "Message Box Works", NULL); return (0); } Thanks in advance, toejam2000

Share this post


Link to post
Share on other sites
Advertisement
I might also suggest checking out C#. Raw Win32 code is just not worth it anymore. You can cut down those 200 lines of code to about 20 using WinForms and C#. But then again, to each his own.

Share this post


Link to post
Share on other sites
As kitofr said, it's likely that you;ve created a C++ console project instead of a Windows executable.

When you create a console project, the linker looks for a int main(int argc, char *argv[]) function for the program's entry point. When you use a windows project, it looks for the WinMain function you have defined here.

If this is the problem, you should be recieving a linker error that mentions something about symbol main (or _main) not being found. To fix this, either twiddle with your project settings or recreate the project as a Windows executable.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!