Lightweight and convenient sublime text 3 code editing is very powerful, but as a code-editing software, if we let it run our C or C + + code, and become a lightweight compiler that's better! Let's talk about it today. How to Sublime C/C + + in order to enable it to run the code (with Sublime:sublime Text 3)) [http://www.sublimetext.com/]
First of all, we have a compiler, if you already have codeblocks or dev-c++, then look directly at the next step. If not, we need to download a compiler first, here is (MinGW: MinGW) [http://www.mingw.org/]
Installing MinGW
Configure environment variables. Locate the Bin folder under your MinGW installation path, configure environment variables
Configure sublime, open sublime, click Tools→build system→new Build System
{ "cmd": ["g++", ,"-Wall","${file}", "-o", "${file_path}/${file_base_name}"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++", "encoding":"cp936", "variants": [ { "name": "Run", "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", "${file_path}/${file_base_name}"] }, { "name": "RunInCommand", "cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"] } ]}
To configure a compilation shortcut key
[ {"keys": ["ctrl+F11"], "command": "build", "args": {"variant": "RunInCommand"}}]
Sublime No Debug
Sublime Text Add A/C + + Environment