sublime text 3 完美实现gcc编译并运行
1.首先,添加自定义buildsystem
打开 tools-> Build System -> New build system
2.清空弹出的文件,将以下内容复制到文件中
{
"cmd": ["gcc", "${file}", "-fexec-charset=gbk", "-std=c99", "-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": "Build and Run",
"cmd": ["cmd","/C","gcc", "${file}", "-fexec-charset=gbk", "-std=c99", "-o", "${file_path}/${file_base_name}","&start","cmd","/c", "${file_path}/${file_base_name}.exe &pause"]
}
]
}
注意,本build方式默认以GBK方式编译以防止cmd乱码,使用c99标准
_(:3 」∠)_