GCC converting to execution character set:无效或不完整的多字节字符或宽字符

  现在想在Linux下显示中文

  代码如下

 

#include <clocale>
#include <cwchar>

void optionVersion()
{
 
    wchar_t wstr[] = L"简体中文版 by 大师♂罗莊";    
    wprintf(L"%ls",wstr);
    exit(0);
}

报错converting to execution character set:无效或不完整的多字节字符或宽字符。

上网查没有找到解决方法。

自行研究发现,需要指定GCC或者G++ 的编码

比如我的源文件是gbk编码,那么这样加参数 -finput-charset='gbk'

输出中文,赏心悦目:

luozhuang@luozhuang-virtual-machine ~/NetBeansProjects/Onscripter-20121116cnlinux/dist/Release/GNU-Linux-x86 $ ./onscripter-20121116cnlinux 
<init> : Avifile RELEASE-0.7.48-120520-08:05-../src/configure
<init> : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss nx rdtscp lm constant_tsc up arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc
<init> : 1995.53 MHz Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz processor detected
ONScripter version 20120701 简体中文版 by 大师罗莊(2.96)
can't open any of 0.txt, 00.txt, nscript.dat and nscript.___
luozhuang@luozhuang-virtual-machine ~/NetBeansProjects/Onscripter-20121116cnlinux/dist/Release/GNU-Linux-x86 $ 



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值