首页

欢迎

 

Welcome

欢迎来到这里, 这是一个学习数学、讨论数学的网站.

IMAGINE, THINK, and DO
How to be a scientist, mathematician and an engineer, all in one?
--- S. Muthu Muthukrishnan

Local Notes

Local Notes 是一款 Windows 下的笔记系统.

Local Notes 下载






注册

欢迎注册, 您的参与将会促进数学交流. 注册

在注册之前, 或许您想先试用一下. 测试帐号: usertest 密码: usertest. 请不要更改密码.


我制作的 slides

Problem

随机显示问题

Problèmes d’affichage aléatoires

软件 >> C++ >> CodeBlocks
Questions in category: CodeBlocks (CodeBlocks).

CodeBlocks 文件编辑和程序编译的编码设置

Posted by haifeng on 2018-04-10 13:16:43 last update 2018-04-14 11:24:50 | Answers (0)


如果编码不一致,则在编译时会出现下面的错误:

 

||=== Build: Release in Josephus (compiler: GNU GCC Compiler) ===|
D:\work\cs\c++\datastruct\Exercise\Josephus\main.cpp||In function 'int main()':|
D:\work\cs\c++\datastruct\Exercise\Josephus\main.cpp|34|error: converting to execution character set: Illegal byte sequence|
D:\work\cs\c++\datastruct\Exercise\Josephus\main.cpp|36|error: converting to execution character set: Illegal byte sequence|
D:\work\cs\c++\datastruct\Exercise\Josephus\main.cpp|38|error: converting to execution character set: Illegal byte sequence|
D:\work\cs\c++\datastruct\Exercise\Josephus\main.cpp|40|error: converting to execution character set: Illegal byte sequence|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

 

 

设置办法:

文件编码:
Setting -> Editor ->General settings -> Encoding settings

此处默认Windows-936即gbk

编译编码:
Setting -> Compiler -> Global compiler settings -> other compiler options

在框中输入:
    -finput-charset=GBK
    -fexec-charset=GBK

 

如果需要跨平台, 建议都设置为 UTF-8, 即

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


References:

这里设置办法参考自

http://www.cnblogs.com/thingk/p/4224186.html