|
楼主 |
发表于 2005-7-6 19:09:49
|
显示全部楼层
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("你好");
hello.resize(100, 30);
hello.show();
return app.exec();
}
编译后,中文是乱码,如果加tr那就应该是
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello(tr("你好"));
hello.resize(100, 30);
hello.show();
return app.exec();
}
对不?可连make都过不去呀,提示:
Setting up a MinGW/Qt only environment...
-- QTDIR set to d:\Qt\4.0.0
-- PATH set to d:\Qt\4.0.0\bin
-- Adding d:\MinGW\bin to PATH
-- Adding C:\WINDOWS\System32 to PATH
-- QMAKESPEC set to win32-g++
d:\Qt\4.0.0>cd d:\123
D:\123>qmake -project
D:\123>qmake
D:\123>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `D:/123'
g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D
LL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I"D:/Qt/4.0.0/include/QtGui" -I"D:/Qt/4.0.0/include/QtCore" -I"D:/Qt/4.0.0/inc
lude" -I"." -I"D:/Qt/4.0.0/include/ActiveQt" -I"release" -I"." -I"d:\Qt\4.0.0\mk
specs\win32-g++" -o release\a.o a.cpp
a.cpp: In function `int qMain(int, char**)':
a.cpp:8: error: `tr' undeclared (first use this function)
a.cpp:8: error: (Each undeclared identifier is reported only once for each funct
ion it appears in.)
a.cpp:13:6: warning: no newline at end of file
mingw32-make[1]: *** [release\a.o] Error 1
mingw32-make[1]: Leaving directory `D:/123'
mingw32-make: *** [release] Error 2
D:\123>
我是在win下编译的,不是在linux下,如果在LINUX,一定可以出中文,这点我相信 |
|