A
A
ArthurTBN2015-05-23 19:22:09
C++ / C#
ArthurTBN, 2015-05-23 19:22:09

Sublime Text 3. Opening compiled .exe file in windows cmd?

Bottom line: I have already set up ST3 for C ++, already knows how to compile code and even displays the results in the editor console. But I want to make ST automatically open compiled .exe files on the command line (at least so that you can enter custom values.
My .sublime-build file:

{
  "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": ["${file_path}/${file_base_name}.exe"]
    }
  ]
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chz, 2015-05-31
@chz

In principle, the Run build system is correct, have you tried running the Run option yet?

M
Maxim Medved, 2015-07-05
@woodser

This code works for me, I edited it myself by trial and error:

{
  "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
  "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
  "working_dir": "${file_path}",
  "selector": "source.c, source.c++",
  "shell": true,
  "encoding": "1251",
  "variants":
  [
    {
      "name": "Run",
      "shell": true,
      "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&&",
          "start", "${file_base_name}", "${file_path}/${file_base_name}"]
    }
  ]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question