sublime text 3编写c++代码,代码中含有中文输出内容,编译后cmd下编译出乱码

sublime text 3编写c++代码,代码中含有中文输出内容,编译后cmd下编译出乱码

 

有没有办法能让sublime能一直保持文件保存 就为gbk格式,不需要每个文件都要在菜单中选择选择 中文gbk格式

https://blog.csdn.net/Timekeeperl/article/details/61630207

 

Tools——>Build System ——>New Build System

将新编译系统命名为C++

在C++.sublime-build文件中加入以下脚本

 

{
"cmd": ["g++","-fexec-charset=GBK", "${file}", "-o","${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
"working_dir": "${file_path}",
"encoding":"cp936",
"selector": "source.c",
"variants":
[
{
"name": "Run",
"cmd": ["cmd","/C","start","cmd","/c", "${file_path}/${file_base_name}.exe &pause"]
}
]
}