#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char *argv[] )
{
QApplication a(argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
root@style:/zb/souqt# qmake -project
root@style:/zb/souqt# qmake
root@style:/zb/souqt# make
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.1.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.1.2/include/QtCore -I/usr/local/Trolltech/Qt-4.1.2/include/QtGui -I/usr/local/Trolltech/Qt-4.1.2/include -I. -I. -I. -o qt.o qt.cpp
qt.cpp: In function `int main(int, char**)':
qt.cpp:27: error: `setMainWidget' undeclared (first use this function)
qt.cpp:27: error: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [qt.o] 错误 1
root@style:/zb/souqt#
郁闷,我安装的QT4.01
[ 此贴被XChinux在2006-05-12 08:20重新编辑 ]