Skip to content

Instantly share code, notes, and snippets.

@vhanla
Forked from mikhdm/Visual C++.sublime-build
Last active May 5, 2021 12:42
Show Gist options
  • Save vhanla/06afec87e704ab91a04c89e41eb165b2 to your computer and use it in GitHub Desktop.
Save vhanla/06afec87e704ab91a04c89e41eb165b2 to your computer and use it in GitHub Desktop.
Visual C++ build system for sublime text to exec and compile .c and .cpp files from Subime Text editor.
{
"cmd": ["vcvars32.bat", "&&", "cl", "/EHsc", "/Za", "${file}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.cpp, source.c++",
// By default cl is not in your PATH, so add it to your path (preferably)
// or uncomment "path" and check that it has correct value
//"path": "%PATH%;path:/to/folder/where/cl.exe/located",
// e.g. "path" : "%PATH%;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\",
// this also will set path for vcvars32.bat
"shell": true, // Without this sublime has hard times to parse "&" in out command line
"variants":
[
{
"name": "Run in output window", // for console programs that don't require input, otherwise it might run hidden
"cmd": ["vcvars32.bat", "&&", "cl", "/EHsc", "/Za", "${file}", "&&", "${file_path}/${file_base_name}.exe"]
},
{
"name": "Run in external window", // recommended
"cmd": ["vcvars32.bat", "&&", "cl", "/EHsc", "/Za", "${file}", "&&", "start", "/D", "${file_path}", "${file_base_name}.exe"]
}
]
}
@phil123456
Copy link

The syntax has probably changed forr ST3

Traceback (most recent call last):
  File "c:\Program Files\Sublime Text 3\sublime_plugin.py", line 795, in run_
    return self.run(**args)
  File "exec in c:\Program Files\Sublime Text 3\Packages\Default.sublime-package", line 238, in run
TypeError: Can't convert 'list' object to str implicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment