Tuesday, July 14, 2009

Dev-C++ compiler problems?

Every time I create a program that doesn't prompt for cin input, the execution window closes immediately after the program executes. Therefore, to me it just displays a "flash" of the program. I am not familiar with this compiler like I am with M. Visual Studio, so I don't know how to fix it. Are there any options that need to be changed so that the execution window doesn't automatically exit? Could you tell me step by step how to do that?





Thanks.

Dev-C++ compiler problems?
that's because you're compiling a command line program. So when the program is started, a command line window is spawned, your program is executed, and afterwards, when your program exits, the command line window exits, too.





things could be worse: if you write a Win32 program which does not have a dialog window, you don't even see the flash, you don't see anything.





Some solutions were suggested, an alternative is to start cmd.exe, go to the directory where your exe file is, and start it from the command line.
Reply:Adding system("pause"); in your code will cause the program to wait for a key to be pressed before it continues allowing you to see the program.
Reply:Hi USAman!!! What's up? Ahhhh I'm soo bored right now! I'd totally help you if I knew that much about computers...
Reply:The MS compiler does that automatically.





To keep the code portable use this macro.





#ifndef _MSC_VER


system("pause");


#endif





Include the %26lt;cstdlib%26gt; header to use the system function.


No comments:

Post a Comment