I'm using Sublime Text 3 for C programming. I want to compile and run my programs in the gnome terminal using a keybinding or something like that instead of the ST3 console (like CodeBlocks does). How can I do it?
我使用的是C编程的卓越的文本3。我希望通过使用一个键绑定或类似于ST3控制台(比如CodeBlocks)来编译和运行gnome终端中的程序。我怎么做呢?
1 个解决方案
#1
1
Click Tools->Build System->New build system
to add a new build system, copy following code:
点击工具->构建系统->新构建系统添加一个新的构建系统,复制以下代码:
{
"cmd" : ["gnome-terminal -x bash -c \"gcc $file_name -o ${file_base_name} -lm -Wall; ./${file_base_name}; exec bash\""],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}
Save this file.
保存这个文件。
Then click Tools->Build System
to choose the newly stored build system. Every time you press "Ctrl+B", the keybinding of Tools->build
, it will run gnome-terminal and compile&run your program automatically.
然后单击Tools->构建系统来选择新存储的构建系统。每当你按下工具的键绑定“Ctrl+B”——>构建时,它就会运行gnome-terminal并自动编译并运行你的程序。
#1
1
Click Tools->Build System->New build system
to add a new build system, copy following code:
点击工具->构建系统->新构建系统添加一个新的构建系统,复制以下代码:
{
"cmd" : ["gnome-terminal -x bash -c \"gcc $file_name -o ${file_base_name} -lm -Wall; ./${file_base_name}; exec bash\""],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}
Save this file.
保存这个文件。
Then click Tools->Build System
to choose the newly stored build system. Every time you press "Ctrl+B", the keybinding of Tools->build
, it will run gnome-terminal and compile&run your program automatically.
然后单击Tools->构建系统来选择新存储的构建系统。每当你按下工具的键绑定“Ctrl+B”——>构建时,它就会运行gnome-terminal并自动编译并运行你的程序。