Dev C++ help

Syn7ax 3rror

Banned
Messages
546
Hello all. i just installed Dev C++ and tried to compile a program. But, when I hit "run", a window just flashed up for a milisecond then went away. Please tell me what I am doing wrong. It linked and compiled correctly and has no bugs.
 
Chances are you're not doing anything wrong.

Add the following line to the end of your program:

Code:
system("pause");

Put it just before the final closing brace in int main()

You'll then see your window stay open and it'll say "Press any key to continue..." instead of just exiting.

To get around this problem without that extra code, just open up Command Prompt, navigate to the directory that contains your exe, and run it from there. The window won't close after you run the program.
 
Ok heres what I got

code:

#include <iostream>

int main()
{
std::cout << "Hello World/n;"
;return 0;
system("PAUSE");

}

But when I complie it says done but when I hit run it syas "Project not compiled. I did a compile and run in one step and the cursor still flashed. Please help.
 
I've changed your code as follows:

Code:
#include <iostream>

int main()
{
std::cout << "Hello World\n";
system("PAUSE");
return 0;
}

What I've put up there works perfectly for me. Make sure return 0; is the final statement (I was wrong earlier about system("pause"); being the last).

Note the ; comes at the end of the lines, not at the end of the text string.

Any more problems, feel free to let me know.
 
Back
Top Bottom