一、sublime text3,Tools/Build System/New Build system建立一个新配置文件。c++
{
"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}"]
}
]
}ui
二、将这一段复制粘贴,保存成C.sublime-build。cmd
再建立一个新的.c文件,如helloworld.c,cmd+b编译,shift+cmd+b运行,便可。编译
附:直接使用终端写Cgcc
一、建立hello.c文件;配置
二、gcc hello.c编译;file
三、编译完成后,会生成a.out文件,为可执行文件,./a.out 便可运行。select