Jump to content
  • Advertisement
Sign in to follow this  
rpstaekwondo

error

This topic is 3802 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

ok, i have been trying to make a tiny little text game, its really simple, but when i try to make it, i get an error, tell me wats wrong plz #include <iostream> #include <windows.h> using namespace std; int main(){ cout << "in this game, a random number will be selected, and you must guess it \n"; cout << "generating number" << "\n"; int x; x = rand(); for(;;){ int guess; cout << "try to guess the number: "; cin >> guess; cout << "\n"; if(guess == x){ MessageBox(NULL, "that was correct, good job!!!", "you win", MB_OK | MB_HELP); break; } if(guess < x){ cout << "higher!" << "\n"; } if(guess > x){ cout << "lower!" << "\n"; } } }

Share this post


Link to post
Share on other sites
Advertisement
What is the error? I'm going to guess that it is complaining about WinMain missing. Unless you are building a Windows application, do not include windows.h. That means you can't use MessageBox, but you can use std::cout instead to print to the console.

Share this post


Link to post
Share on other sites
What kind of error? Compile error? Link error? Runtime error? Do Oompa Loompas come out of your computer and sing songs of woe?

Share this post


Link to post
Share on other sites
My guess is you get an error like "Cannot convert const char* to LPCWSTR". If that's the case, change your project settings to Multi Byte Character Set instead of Unicode (Project Properties (Alt+F7) -> Configuration Properties -> General -> Character Set, in VC2005 from memory - it's probably the same in VC2003 or VC2008).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!