sublime—text终端无法输入,不支持scanf、input等语法问题的解决
sublimetext是个很好用的轻量编辑器,,支持多语言语法高亮,自动补全,快捷键编译运行,而且ui也不错挺简洁,我一直在用。我之前浏览帖子时候看到有些人也在用这个编辑器。
但是吧,这个编辑器的的编译运行功能有点令人dan teng,它是把shell执行的结果读回来显示在终端,这意味着什么呢?这意味着特喵的无法使用输入语句,无法使用调试功能。
不多废话了直接解决方法
在sublime->工具->编译系统里新建编译系统,输入以下内容
{ "cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "selector" : "source.c, source.c++", "shell":false, "working_dir" : "$file_path", "variants": [ { "name": "RunInCommand", "cmd": ["cmd", "/c", "gcc","-g", "${file}", "-o", "${file_path}/${file_base_name}", "&&","start", "cmd", "/k", "${file_path}/${file_base_name}"] } ] }
这是c语言的编译器,支持gdb
再新建编译系统输入
{ "cmd" : ["javac", "$file_name"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "selector" : "source.java", "shell":false, "working_dir" : "$file_path", "variants": [ { "name": "RunInCommand", "cmd": ["cmd", "/c", "javac","${file}","&&","start", "cmd", "/k", "java $file_name"] } , { "name":"Debug", "cmd": ["cmd", "/c","javac","${file}","&&","start", "cmd", "/k","gdb ${file_path}/${file_base_name}"] } ] }
这是java编译系统
再新建编译系统输入
{ "cmd" : ["g++", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "selector" : "source.c, source.c++", "shell":false, "working_dir" : "$file_path", "variants": [ { "name": "RunInCommand", "cmd": ["cmd", "/c", "g++","-g", "${file}", "-o", "${file_path}/${file_base_name}", "&&","start", "cmd", "/k", "${file_path}/${file_base_name}"] } ] }
这是c++编译系统,支持gdb
由于我常用这三种语言暂时就配置了这三种语言,其他语言可以参考这三种配置,原理都一样,编译完直接使用命令提示符打开不用它自带的那个终端显示
QQ:269672173
博客地址:https://www.cnblogs.com/airlongdianblog/(博客园) https://airlongdian.github.io/(个人笔记)
bilibili:万能的小奇喵
转载请注明出处