标题:Qt creator编译提示出现乱码,百思不得其解??
作者:fishofocean
日期:2016-05-23 21:28
内容:
我在使用Qt creator时,当程序有错误时,编译输出(compile output)总是乱码,判断不了是程序中的什么错误,弄了很多天也解决不了,网上搜到的没有针对我这种问题的答案,太痛苦了!哪位大侠知道啊?
编译环境是Qt creator 2.0.1(QT Design为4.7)
乱码为:
..\DialogExample\dialog.cpp: In constructor 鈥楧ialog::Dialog(QWidget*)鈥
..\DialogExample\dialog.cpp:14: 閿欒 锛歟xpected type-specifier before 鈥楪ridLayout鈥
..\DialogExample\dialog.cpp:14: 閿欒 锛氫笉鑳藉皢鈥榠nt*鈥欒浆鎹负鈥楺GridLayout*鈥欙紝鍦assignment 涓
..\DialogExample\dialog.cpp:14: 閿欒 锛歟xpected 鈥鈥before 鈥楪ridLayout鈥
全部信息为:
Running build steps for project QLayout...
Configuration unchanged, skipping qmake step.
Starting: "D:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/qt_ui/QLayout-build-desktop'
D:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/qt_ui/QLayout-build-desktop'
mingw32-make[1]: Nothing to be done for `first'.
mingw32-make[1]: Leaving directory `D:/qt_ui/QLayout-build-desktop'
mingw32-make: Leaving directory `D:/qt_ui/QLayout-build-desktop'
The process "D:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited normally.
Running build steps for project DialogExample...
Configuration unchanged, skipping qmake step.
Starting: "D:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/qt_ui/DialogExample-build-desktop'
D:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `D:/qt_ui/DialogExample-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\ ..
#1 [fishofocean 05-23 21:35]
对了,Qt creator是英文版的,输出的错误信息也应该全是英文,不知道怎么就有乱码了。
系统是Win7的,装的是Qt SDK 单个文件的完整安装包。
#2 [zhanglyl 05-24 09:32]
请将源码文件转换为utf8格式。
#3 回 zhanglyl 的帖子 [fishofocean 05-24 20:31]
zhanglyl:
请将源码文件转换为utf8格式。
我试了好几次,修改Qt creator里边的环境中file coding为UTF8格式,而且之后重新打开软件,但还是编译输出乱码。 并且我修改设置后重新建了一个工程,编译后也是这样,只要程序有错误,它的编译信息就乱码。如果程序正确,编译信息就不会有乱码。
很神奇的问题,太奇怪了!
#4 [fishofocean 05-24 22:46]
问题解决了! 是在系统环境变量中增加一个变量LANG,值为en。困扰我很多天的乱码问题终于解决了!
是在本网站这里找到答案的,http://www.qtcn.org/bbs/read-htm-tid-44875.html
感谢网友pbprince,也要感谢网友zhanglyl。