- 命令行安裝gcc
brew install gcc
2.工具欄打開Tools->Build System->New Build System钠惩,在新建的文件中輸入以下內(nèi)容:
{
"cmd": ["gcc", "${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}"]
}
]
}
保存成C.sublime-build
3.快捷鍵:cmd+b(編譯)晨继,shift+cmd+b(運(yùn)行)