Home Download Buy Blog Forum Support

Run C++ on Windows

Run C++ on Windows

Postby agibsonsw on Thu Oct 25, 2012 5:02 pm

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: Select all
{
   "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}'"]
      }
   ]
}
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Run C++ on Windows

Postby agibsonsw on Thu Oct 25, 2012 5:26 pm

Well, fiddling around, I've got it to run in the output panel :)

Code: Select all
   "variants":
   [
      {
         "name": "Run",
            "cmd": ["${file_base_name}.exe"]

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.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Run C++ on Windows

Postby agibsonsw on Fri Oct 26, 2012 7:36 pm

Code: Select all
   "variants":
   [
      {
         "name": "Run",
            "cmd": ["${file_base_name}.exe"]


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.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 29 guests