Ubuntu16.04使用sublime text3编写C语言后,实现编译并自动调用bash终端运行程序


实现编译并自动调用bash运行程序只需要新建自己的.build文件就OK 
依次打开:

tools->building system->new building system

后,把下面的内容粘贴后,按Ctrl+s保存,会自动打开user目录(Sublime Text 3\Packages\User),我们修改 文件名为 C.sublime-build,

这时候,可以在Tools -> Build System下看到刚才新建的C了, 选择C;编写项目后保存按Ctrl+B调用bash终端运行

{
"shell_cmd": "gcc -std=c99 \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c",

"variants":
[
{
"name": "Run",
"shell_cmd": "gnome-terminal -x bash -c \"if [ -f '${file_path}/${file_base_name}' ]; then rm '${file_path}/${file_base_name}'; fi; gcc -std=c99 '${file}' -o '${file_path}'/'${file_base_name}'; '${file_path}'/'${file_base_name}'; read -p 'Process Exit, Press any key to quit...'\""
}
]
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM