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

编程入门 行业动态 更新时间:2024-10-09 06:27:46

GCC converting to execution character set:无效或不完整的<a href=https://www.elefans.com/category/jswz/34/1688045.html style=多字节字符或宽字符"/>

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 $ 



更多推荐

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

本文发布于:2024-02-07 12:47:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756825.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多字   字符   或不   完整   converting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!