//位置前面写得很清楚了 这是我用过的最好用的版本
{
"cmd": ["gcc","-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", "gcc", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", "${file_path}/${file_base_name}"]
},
{
"name": "RunInCommand",
"cmd": ["cmd", "/c", "gcc", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"]
}
]
}
//加了 -Wall 警告 和最后输出结果暂停CMD框也就是类似getchar()的效果 不通过不会打开CMD框
需要自己写个宏 Preferences->Key bindings user
[
{"keys": ["f5"], "command": "build", "args": {"variant": "RunInCommand"}}
]
//我是直接F5 编译执行