How to run programs in an external console with Sublime Text in Windows system?

Viewed 23127

I managed to configure Sublime Text 2 for C++ and I can now compile my code (using the MinGW compiler).

Unfortunately, the Sublime Text console can't support any kind of input for C++.

I want to open my compiled program in an external console (Window's terminal for instance). I tried to use "call" or "cmd" but couldn't make it work. (it still opens the file in the console)

Here's my build configuration:

{
"cmd": ["C:\\MinGW\\bin\\mingw32-g++.exe", "-Wall", "-time", "$file", "-o", "$file_base_name"],
"cmd": ["call", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"working_dir": "${project_path:${folder}}",
"selector": "source.c",
"shell": true,
"encoding": "latin1"
}
6 Answers

This is WORKING !!

{"cmd": ["g++", "-Wall", "-ansi", "-pedantic-errors", "$file_name", "-o", 
"${file_base_name}.exe", "&&", "start", "cmd", "/k" , "$file_base_name"],
"selector": "source.cpp",
"working_dir": "${file_path}",
"shell": true}
  • Just goto Tools>Build Sytem>New build System..."C++.sublime-build"...and Must SAVE it as ALL FILES
  • Select that build

Just enter (ctrl+b) to see an elevated command prompt open and give your inputs like other IDE's.

Related