Keeping window open in DevC++
Author |
Message |
bass_maniac
|
Posted: Mon May 22, 2006 5:08 pm Post subject: Keeping window open in DevC++ |
|
|
Hi. I've just started learning C++ and I'm using the DevC++ compiler. My problem is that when I run the program it opens the window, runs it really quickly and closes the window before I see what it's done. I've been using the sleep command, but it seems there should be a setting somewhere to keep it from closing. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Mon May 22, 2006 5:30 pm Post subject: (No subject) |
|
|
You're running into a fundamental command-line issue.
When you open a terminal (and cmd.exe is close enough to one for government work) for the purpose of running a single app, then it only stays open long enough to run that app. As soon as the program terminates, so does the terminal, and once that's gone, the window has no reason to exist.
So, you either have to have some way to keep your program from terminating (until you want it to), or open a terminal and execute the program from it. If you open the terminal separately, then it will hang around after the program you write is done doing its thing. |
|
|
|
|
|
bass_maniac
|
Posted: Mon May 22, 2006 5:34 pm Post subject: (No subject) |
|
|
Thanks wtd, I'll try that. Does that mean I have to make my files into .exe's and execute them from the command terminal or is there a way to just compile and run them from the command terminal? |
|
|
|
|
|
wtd
|
Posted: Mon May 22, 2006 5:42 pm Post subject: (No subject) |
|
|
bass_maniac wrote: Thanks wtd, I'll try that. Does that mean I have to make my files into .exe's and execute them from the command terminal or is there a way to just compile and run them from the command terminal?
Yes, you can use compilers from the command-line. Dev-C++ installs a compiler that can be used in this fashion, but it uses a somewhat outdated compiler, and installs it in kind of a funky way.
I suggest following Gandalf's advice in his thread on installing MinGW. |
|
|
|
|
|
bass_maniac
|
Posted: Mon May 22, 2006 5:44 pm Post subject: (No subject) |
|
|
OK, thanks for the help. |
|
|
|
|
|
[Gandalf]
|
Posted: Mon May 22, 2006 6:42 pm Post subject: Re: Keeping window open in DevC++ |
|
|
wtd, you forgot one nagging point...
bass_maniac wrote: Hi. I've just started learning C++ and I'm using the DevC++ compiler.
DevC++ is not a compiler, it is and IDE (Integrated Development Environment) which uses the GCC compiler. |
|
|
|
|
|
|
|