展开全部
sublime text 3
tools->build system ->new build system
添加这段json格式代码:{
"shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\" `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` ",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.cpp, source.h",
"variants":
[
{
"name": "Run",
"shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\" `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`&& \"${file_path}/${file_base_name}\""
}
]
}
保存为C.sublime-build,重启sublime text ->build system->C.
ctrl+b 编译
ctrl+shift+b 编译并运行e69da5e6ba9062616964757a686964616f31333332643237
由于我要写gtk程序所以加了`pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` ,纯c的话你也可以删除不要。
自定义头文件
这我没搞懂,是不是后缀名自定义?
如果是,在selector后面添加 source.xxx (xxx是你自己的定义的后缀).