Sublime3 [Decode error - output not utf-8]

2025-10-16 19:37:05

1、我们用到的C/C++编译器使用的是gcc/g++,所以需要下载安装MinGW.

安装时尽量避免中文路径.

WIN7及低版本Windows:

右击我的电脑,点属性->高级->环境变量。然后:

在PATH里加入C:\MinGW\bin;<--(视情况而定,我安装在E盘,我的就是"E:\Program Files (x86)\mingw\bin;")如果里面还有其他的变量,记得要加分号,分号得在英文输入模式下输入的。

2、新建LIBRARY_PATH变量,如果有的话,在值中加入C:\MinGW\lib,这是标准库的位置。我的就是("E:\Program Files (x86)\mingw\lib;")

3、新建C_INCLUDEDE_PATH变量,值设为C:\MinGW\include,我的是"E:\Program Files (x86)\mingw\include;")。

WIN8及高版本Windows:

鼠标向右滑动至屏幕边缘,点开设置.再点开控制面板,直接输入"环境变量","编辑系统的环境变量",然后和上面相同.

检验是否成功:命令行下输入"gcc -v".

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

2、点击Tools →Build System→New build System…

删除里面所有的东西.

再输入:

{"cmd": ["gcc","${file}", "-o", "${file_path}/${file_base_name}"],"file_regex":"^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$","working_dir":"${file_path}","selector": "source.c","variants":[{"name": "Run","cmd": ["cmd","/c", "gcc", "${file}", "-o", "${file_path}/${file_base_name}","&&", "cmd", "/c","${file_path}/${file_base_name}"]},{"name":"RunInCommand","cmd": ["cmd","/c", "gcc", "${file}", "-o","${file_path}/${file_base_name}", "&&","start", "cmd", "/c","${file_path}/${file_base_name} & pause"]}]}

★再保存为:"C.sublime-build"

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

3、按下Ctrl+Shift+P

输入: ConvertToUTF8,安装好后,点击

文件>set file encoding to>utf-8

文件>reload encoding with>utf-8

重启电脑.

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

Sublime3 [Decode error - output not utf-8]

4、这时你就会发现:编译成功.

Sublime3 [Decode error - output not utf-8]

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢