1、下载sublime text链接如下:
https://download.sublimetext.com/Sublime%20Text%20Build%203211%20x64%20Setup.exe
注意:切勿升级该版本。
2、调整编码和译码格式,避免输出乱码(需要下载Chinese simplified(GBK)编码格式)在sublime里安装即可,自行百度即可
以下配置,需要注意:(免得输出是乱码)
(1)文件–>set File Encoding to–>Chinese simplified(GBK)
(2)文件–>reload with Encodeing–>Chinese simplified(GBK)
3、工具–>编译系统–>自建编译系统(将原先内容删除,配置如下)
注意:在配置C/C++时,需要先配置MinGW(自行安装)
(1)对于C配置自建编译系统如下:
{
"cmd": ["gcc","${file}","-o", "${file_path}/${file_base_name}"],
"file_regex":"^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir":"${file_path}",
"selector": "source.c",
"encoding":"ctf8",
"variants":
[
{
"name": "C_Run",
"cmd": ["cmd","/c", "gcc", "${file}", "-o", "${file_path}/${file_base_name}","&&", "cmd", "/c","${file_path}/${file_base_name}"]
},
{
"name":"C_RunInCommand",
"cmd": ["cmd","/c", "gcc", "${file}","-o","${file_path}/${file_base_name}", "&&","start", "cmd", "/c","${file_path}/${file_base_name} & pause"]
}
]
}
添加完后,需要保存为gcc.sublime-build
(2)对C++配置自建编译系统如下:
{
"cmd": ["g++","-Wall", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"encoding":"utf8",
"variants":
[
{
"name": "C++_Run",
"cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", "${file_path}/${file_base_name}"]
},
{
"name": "C++_RunInCommand",
"cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"]
}
]
}
添加完后,需要保存为g++.sublime-build
(3)配置java重点:
注意:在配置之前,需要配置java环境变量(自行搜索),这是学java的基本攻略
验证:win+R–>cmd
–>java/(javac)/(java -version)–>是否有正常信息及版本型号,若有则添加java环境变量成功(如下即可成功)
出现如
(3)配置java自建编译系统如下:
找到sublime安装目录–>Packages–>用压缩包方式打开Java.sublime-package–>找到JavaC.sublime-build,修改为如下:
{
"cmd": ["javac", "$file_name", "&&", "java", "$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector": "source.java",
"shell": true,
"encoding":"utf8"
}
本身就是修改文件,不用修改文件名
注意!!!
C/C++需要MinGW,安装即可,路径可任意,尽量不用中文路径
java需要安装java的环境变量,若安装,直接配置自建编译下图的代码,即可运行。
(1)运行C,工具–>编译系统gcc–>ctrl+B
(2)运行C++,工具–>编译系统g+±->ctrl+B
(3)运行java,工具–>编译系统javaC–>ctrl+B
(4)python由于是自带,不需要配置
(5)HTML由于是自带,不需要配置
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)