- tools>Build System>New Build System中写入
{
"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即可
3. 然后ctrl+shift+b选择g++编译
关键是加上"-fexec-charset=gbk"