- 安装sublime, mingw, 将mingw路径添加至环境变量
- 安装插件Package Control
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
- 安装插件ConverttoUTF8 解决文件乱码
- 新建编译系统,选择tool –> Build System –> New Build System,添加代码并保存为c++.sublime-build
{
"working_dir": "$file_path",
"shell_cmd": "g++ -Wall -std=c++11 -g \"$file_name\" -o \"$file_base_name\" && size \"$file_base_name\".exe",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c++",
"variants":
[
{
"name": "Debug",
"shell_cmd": "start cmd /c \"gdb \"${file_path}/${file_base_name}\"\""
},
{
"name": "CMD Run",
"shell_cmd": "g++ -Wall -std=c++11 -g \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
},
{
"name": "Run with Input",
"shell_cmd": "g++ -Wall -std=c++11 -g \"$file\" -o \"$file_base_name\" && \"${file_base_name}\" < in.txt "
}
]
}
- 添加GDB调试快捷键,选择Preference –>Key Bindings 添加代码
{"keys": ["f5"], "command": "build","args": {"variant": "Debug"} }
OK
网友评论