Windows – Console app with Qt Creator on Windows : wait before closing the console


I'm running a very simple console app on Windows with Qt Creator.

When launching it, the dos console is openned, my output is displayed, but then the app terminates and the console immediately closes.

How can I make sure the console will stay open until the user presses a key ?

Best Solution

Since Qt Creator 1.3.0, it's much easier :

Go to the project tab (on the left) to edit the project's setting.

In the section Run Settings, clic on Show details and check the Run in Terminalcheckbox.

Thus, the application will be launched in a console window and the console window will wait until the enter key is pressed before closing.

No need to add some lines to the code anymore !