{
"cmd": ["gcc", "${file}", "-fexec-charset=gbk","-o", "${file_path}/${file_base_name}", "&", "start", "cmd", "/c", "${file_base_name} & echo. & pause"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"encoding":"cp936",
}
2. 保存为g++.sublime-build即可(g++可以改成自己好记的)
3. 然后ctrl+shift+b选择g++编译
https://blog.csdn.net/the_victory/article/details/52452443
python
{
"cmd": ["c:/Python36/python.exe","-u", "$file"], //自己安装路径
"file_regex":"^[ ]*File \"(...*?)\", line ([0-9])*",
"env": {"PYTHONIOENCODING": "utf8"},
"selector": "source.python"
}
java
环境变量
新建JAVA_HOME C:\Program Files\Java\jdk1.8.0_181(jdk绝对路径)
path 最前面添加%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
新建CLASSPATH .;%JAVA_HOME%\bin;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
{"cmd": ["javac", "-encoding", "UTF-8", "-d", ".", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java",
"encoding": "GBK",
//执行完上面的命令就结束
// 下面的命令需要按Ctrl+Shift+b来运行
"variants": [{
"name": "Run",
"shell": true,
"cmd": ["start", "cmd", "/c", "java ${file_base_name} &echo. & pause"],
// /c是执行完命令后关闭cmd窗口,
// /k是执行完命令后不关闭cmd窗口。
// echo. 相当于输入一个回车
// pause命令使cmd窗口按任意键后才关闭
"working_dir": "${file_path}",
"encoding": "GBK"
}]
}