gcc 编译时输出有问号

今天切到一台新的机器上去开发,编译的时候发现 gcc 的输出带着问号,就像这个样子

src/BusiObj.cpp: In member function ?.nt CBusiObj::DecodeUdp(int&, int&, const char*, int)?.
src/BusiObj.cpp:287: warning: format ?.d?.expects type ?.nt?. but argument 6 has type ?.ong unsigned int?
src/BusiObj.cpp:300: warning: format ?.u?.expects type ?.nsigned int?. but argument 7 has type ?._time_t?

看起来十分难受,查了一下是终端字符编码的问题,用 echo $LANG 看一下系统的编码,把终端的编码跟随的调整一下就可以了,修改完成后就是正常的了

src/BusiObj.cpp: In member function ‘int CBusiObj::DecodeUdp(int&, int&, const char*, int)’:
src/BusiObj.cpp:287: warning: format ‘%d’ expects type ‘int’, but argument 6 has type ‘long unsigned int’
src/BusiObj.cpp:300: warning: format ‘%u’ expects type ‘unsigned int’, but argument 7 has type ‘__time_t’

Leave a Reply

Your email address will not be published. Required fields are marked *