Sublime自带了C++构建系统,平时写简单程序demo,直接Ctrl+B即可编译,Ctrl+Shift+B运行。
如果需要调用自己写的Makefile,可以增加一个配置,例如gcc.sublime-build(假定系统安装了MinGW:
{
"cmd": ["make"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.makefile",
"path": "D:\\dev\\MinGW\\msys\\1.0\\bin",
"variants":
[
{
"name": "Clean",
"cmd": ["make", "clean"]
},
{
"name": "Test",
"cmd": ["make", "test"]
}
]
}
运行结果如下: