slacker_x
04-01-2002, 07:00 PM
I just started looking at the QT tutorial at trolltech.com. I made a file called hello.cpp and put this in it:
/************************************************** **************
**
** Qt tutorial 1
**
************************************************** **************/
#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();
}
I then ran
g++ -I /usr/include/qt -o hello hello.cpp
this gave the following results:
/tmp/ccyH3pGR.o: In function `main':
/tmp/ccyH3pGR.o(.text+0x1a): undefined reference to `QApplication::QApplication(int &, char **)'
/tmp/ccyH3pGR.o(.text+0x31): undefined reference to `QString::QString(char const *)'
/tmp/ccyH3pGR.o(.text+0x4d): undefined reference to `QPushButton::QPushButton(QString const &, QWidget *, char const *)'
/tmp/ccyH3pGR.o(.text+0x83): undefined reference to `QPushButton::resize(int, int)'
/tmp/ccyH3pGR.o(.text+0x99): undefined reference to `QApplication::setMainWidget(QWidget *)'
/tmp/ccyH3pGR.o(.text+0xab): undefined reference to `QWidget::show(void)'
/tmp/ccyH3pGR.o(.text+0xba): undefined reference to `QApplication::exec(void)'
/tmp/ccyH3pGR.o(.text+0xd0): undefined reference to `QPushButton::~QPushButton(void)'
/tmp/ccyH3pGR.o(.text+0xe1): undefined reference to `QApplication::~QApplication(void)'
/tmp/ccyH3pGR.o(.text+0x130): undefined reference to `QPushButton::~QPushButton(void)'
/tmp/ccyH3pGR.o(.text+0x14a): undefined reference to `QApplication::~QApplication(void)'
/tmp/ccyH3pGR.o: In function `QString::~QString(void)':
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x26): undefined reference to `QString::shared_null'
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x2e): undefined reference to `QString::shared_null'
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x3d): undefined reference to `QStringData::deleteSelf(void)'
collect2: ld returned 1 exit status
Does anyone have any ideas?
/************************************************** **************
**
** Qt tutorial 1
**
************************************************** **************/
#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();
}
I then ran
g++ -I /usr/include/qt -o hello hello.cpp
this gave the following results:
/tmp/ccyH3pGR.o: In function `main':
/tmp/ccyH3pGR.o(.text+0x1a): undefined reference to `QApplication::QApplication(int &, char **)'
/tmp/ccyH3pGR.o(.text+0x31): undefined reference to `QString::QString(char const *)'
/tmp/ccyH3pGR.o(.text+0x4d): undefined reference to `QPushButton::QPushButton(QString const &, QWidget *, char const *)'
/tmp/ccyH3pGR.o(.text+0x83): undefined reference to `QPushButton::resize(int, int)'
/tmp/ccyH3pGR.o(.text+0x99): undefined reference to `QApplication::setMainWidget(QWidget *)'
/tmp/ccyH3pGR.o(.text+0xab): undefined reference to `QWidget::show(void)'
/tmp/ccyH3pGR.o(.text+0xba): undefined reference to `QApplication::exec(void)'
/tmp/ccyH3pGR.o(.text+0xd0): undefined reference to `QPushButton::~QPushButton(void)'
/tmp/ccyH3pGR.o(.text+0xe1): undefined reference to `QApplication::~QApplication(void)'
/tmp/ccyH3pGR.o(.text+0x130): undefined reference to `QPushButton::~QPushButton(void)'
/tmp/ccyH3pGR.o(.text+0x14a): undefined reference to `QApplication::~QApplication(void)'
/tmp/ccyH3pGR.o: In function `QString::~QString(void)':
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x26): undefined reference to `QString::shared_null'
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x2e): undefined reference to `QString::shared_null'
/tmp/ccyH3pGR.o(.gnu.linkonce.t._._7QString+0x3d): undefined reference to `QStringData::deleteSelf(void)'
collect2: ld returned 1 exit status
Does anyone have any ideas?