我这里说的是13.12 版本,但其实都大同小异。
首先,setting->Editor->Other settings->Encoding,选择 UFT-8,点击OK。
然后,setting->Compiler Setting->Other options,在下方的方框中加入
-finput-charset=UTF-8
-fexec-charset=GBK
点击ok,就可以了。
但是,比如在VS中运行一下代码:
#include <iostream>
using namespace std;
int main(){
cout<<"tomorrow is 晴天"<<endl;
return 0;
}
编译框会输出:
tomorrow is 晴天
但是,如果按照我上面所说的设置之后运行那个代码,Code::Blocks就会报错~,不过一定这么写的话也可以写成 “cout<<"tomorrow is "<<"晴天"<<endl;” 这样就可以编译通过了,至于怎么设置成跟VS一样我暂时还不知道 == ,希望知道的人可以评论一下~