i am new user of qt and i am running ubuntu dapper linux.i got this hello world programe from trolltech official site. i could not run this programe. i got an error.here it is
#include <qapplication.h>
#include <qpushbutton.h>g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12: error: ‘class QApplication’ has no member named ‘setMainWidget’
make: *** [main.o] Error 1
int main( int argc, char **argv )
{
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
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();
}
To copy to clipboard, switch view to plain text mode
then i made .pro file with name main.pro using qmake -project
here is this file
################################################## ####################
# Automatically generated by qmake (2.00a) Wed Mar 7 15:54:23 2007
################################################## ####################
TEMPLATE = app
TARGET +=
DEPENDPATH += .
INCLUDEPATH += .
# Input
SOURCES += main.cpp
then i made make file using qmake
then i ran the command make. after short time it gave the following error
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12: error: ‘class QApplication’ has no member named ‘setMainWidget’
make: *** [main.o] Error 1
Bookmarks