- 安裝sublime, mingw, 將mingw路徑添加至環(huán)境變量
- 安裝插件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 解決文件亂碼
- 新建編譯系統(tǒng)口四,選擇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調(diào)試快捷鍵,選擇Preference –>Key Bindings 添加代碼
{"keys": ["f5"], "command": "build","args": {"variant": "Debug"} }
OK