I am trying to run a simple C++ program on CLion. The problem is that when I try to compile and run it, it shows the result in the application console. I want to run on the System console like the Visual Studio runs the output of the console apps. Is there a way of doing this. I use MINGW compiler.
Asked
Active
Viewed 8,265 times
4 Answers
6
You can use an external terminal, do these steps.
- (top menu) run\ edit Configurations
- tick 'run in external console'

Mario Petrovic
- 7,500
- 14
- 42
- 62

Ali
- 61
- 1
- 2
-
1What IDE version is it? I don't have that option. – Mateusz Budzisz Feb 02 '22 at 09:16
4
Well, if anyone is still around wanting to open an external cmd window on run, there is a way to do it on Windows as well:
- Go to Run > Edit Configurations
- For the executable select C:\Windows\System32\cmd.exe
- For program arguments use: /c "start cmd.exe @cmd /k "ProjectName.exe""
- For working directory set the cmake debug (or release) folder
- Save and select the profile from the dropdown right next to the run button
Note: In the third step /k can be replaced with /c to make the window close after the program is run (with /c its more like visual studio and with /k its more like code blocks)

xeretis
- 65
- 1
- 8
1
the above answer works fine in windows also. In working directory you can set this $CMakeCurrentBuildDir$ enter image description here

suraj pisal
- 11
- 2
0
I am not sure about Windows but in linux you can do it using this answer.
You might be able to change the gnome-terminal to cmd if you are using windows but you will probably need to change the "Program Arguments" too.