• 5161阅读
  • 1回复

trutf8编译出错???? [复制链接]

上一主题 下一主题
离线skyling2001
 
只看楼主 倒序阅读 楼主  发表于: 2006-09-06
源码:
#include <qapplication.h>
#include <qwidget.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qstring.h>

class MyMainWindow :public QWidget
{
public:
  MyMainWindow();
private:
  QPushButton *b1;
};

MyMainWindow::MyMainWindow()
{
  //QString ch;
 
  b1 = new QPushButton( this,"b1" );
  b1->setText( trUtf8( "\xe4\xb8\xad\xe6\x96\x87 中文" ) );
  b1->setGeometry( 20, 20, 300, 300 );
 
  b1->setFont( QFont( "Times", 18, QFont::Bold ) );
 
}

void main( int argc, char **argv )
{
  QApplication a( argc, argv );
  MyMainWindow w;
  a.setMainWidget( &w );
  w.show();
  a.exec();
}  

编译错误:
Debian:/home/yanfeng/Desktop/testqt/chinese2# make
arm-linux-g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/develope/qt-2.3.7/include -o test.o test.cpp
test.cpp: In method `MyMainWindow::MyMainWindow()':
test.cpp:20: implicit declaration of function `int trUtf8(...)'
test.cpp:20: no matching function for call to `QPushButton::setText (int)'
/develope/qt-2.3.7/include/qbutton.h:73: candidates are: void QButton::setText(const QString &)
test.cpp: At top level:
test.cpp:28: return type for `main' changed to `int'
make: *** [test.o] 错误 1


请问这是什么原因造成的,tr()也是同样的出错。谢谢大家!
离线skyling2001
只看该作者 1楼 发表于: 2006-09-06
我用的是qte 2.3.7的库,刚才查了一下QObject.h,发现没有trutf8(),请问这个版本怎么使用中文?谢谢!
快速回复
限100 字节
 
上一个 下一个