Sublime Forum

Run C++ on Windows

#1

Hello. I’m using Windows 7 and have C:\MinGW\bin installed. How can I amend the default Run command to run in a new Console Window please?

[code]{
“cmd”: “g++”, “${file}”, “-o”, “${file_path}/${file_base_name}”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,

"variants":

	{
		"name": "Run",
		"cmd": "bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
	}
]

}[/code]

0 Likes

#2

Well, fiddling around, I’ve got it to run in the output panel :smile:

[code] “variants”:

	{
		"name": "Run",
        "cmd": "${file_base_name}.exe"][/code]

This is cool although, of course, I can’t test input from here. Unless someone knows how I can re-direct input to come from a text file?

Andy.

0 Likes

SublimeClang: Show output inside SublimeText?
#3

[code] “variants”:

  {
     "name": "Run",
        "cmd": "${file_base_name}.exe"][/code]

Does anyone know how I can amend this to add < ${file_base_name}.txt ? That is, redirecting std-input from a text file pl? Andy.

0 Likes