对于codeblocks的编码问题,minGW是gcc的编译器,默认保存格式是utf-8格式,但是我们打开Setting/Editor/Encoding Setting 中可以看见,打开方式默认是windows-936(其实就是gbk格式)。保存和打开格式不一致的情况下,当然会乱码。

下面的操作可以满足:
1、中文注释不乱码
2、可以输出中文
3、解决 error: failure to convert GBK to UTF-8
4、解决 error: converting to execution character set: Illegal byte sequence

1、在 setting // editor // general settings // encoding settings 中,修改如下图红线标识。

codeblocks中文注释乱码、输出中文乱码以及使用OpenCV出现error: failure to convert GBK to UTF-8

2、在Setting // Compiler // Global compiler settings // Other compiler options里面填入

-finput-charset=UTF-8
-fexec-charset=GBK

codeblocks中文注释乱码、输出中文乱码以及使用OpenCV出现error: failure to convert GBK to UTF-8

3、重新保存文件,运行。OK。

相关文章:

  • 2021-04-15
  • 2021-04-20
  • 2021-09-28
  • 2021-12-27
  • 2021-11-27
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-11-03
  • 2021-08-25
  • 2021-11-22
  • 2021-05-26
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案