新打开的文件下添加如下代码,并保存为C.sublime-build.
点击(此处)折叠或打开
- "cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}"],
- "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
- "working_dir": "${file_path}",
- "selector": "source.c",
- "variants":
- [
- {
- "name": "Run",
- "cmd": ["bash", "-c", "gcc '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
- }
- ]
- 在编写程序时记得选择C语言选项如图