Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running CLion on the System console (like Visual Studio)

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.

like image 426
StefanL19 Avatar asked Feb 13 '16 21:02

StefanL19


2 Answers

You can use an external terminal, do these steps.

  1. (top menu) run\ edit Configurations
  2. tick 'run in external console'

enter image description here

like image 115
Ali Avatar answered Sep 18 '22 07:09

Ali


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:

  1. Go to Run > Edit Configurations
  2. For the executable select C:\Windows\System32\cmd.exe
  3. For program arguments use: /c "start cmd.exe @cmd /k "ProjectName.exe""
  4. For working directory set the cmake debug (or release) folder
  5. 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)

like image 37
xeretis Avatar answered Sep 21 '22 07:09

xeretis