[Techtalk] Can't get there from here

Davis, Jennifer JDavis at JUSTICE.GC.CA
Fri Mar 29 00:36:17 EST 2002


I am quickly getting the hang of this coding thing, but I feel really dopey
when trying to get a simple KDE program to compile.  There it is below, and
below it is the output from the compiler.  I just can't figure out what I'm
doing, let alone figuring out what I'm doing wrong.  I guess there is more
to compiling QT/KDE than a simple command line.  Could anyone offer me a
push in the right direction to help me compile my first gui program?

legojenn


#include <qapplication.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    QPushButton *hello=new QPushButton( "Hello world!", 0 );
    hello->resize( 100, 30 );

    QObject::connect( hello, SIGNAL(clicked()), &a, SLOT(quit()) );

    a.setMainWidget( hello );
    hello->show();

    return a.exec();
}

---

jsd at pinky:~$ g++ -o test.exe test.cpp
/tmp/cczyGE3r.o: In function `main':
/tmp/cczyGE3r.o(.text+0x18): undefined reference to
`QApplication::QApplication(int &, char **)'
/tmp/cczyGE3r.o(.text+0x44): undefined reference to `QString::QString(char
const *)'
/tmp/cczyGE3r.o(.text+0x57): undefined reference to
`QPushButton::QPushButton(QString const &, QWidget *, char const *)'
/tmp/cczyGE3r.o(.text+0xd4): undefined reference to
`QObject::connect(QObject const *, char const *, QObject const *, char const
*)'
/tmp/cczyGE3r.o(.text+0xe7): undefined reference to
`QApplication::setMainWidget(QWidget *)'
/tmp/cczyGE3r.o(.text+0x10f): undefined reference to
`QApplication::exec(void)'
/tmp/cczyGE3r.o(.text+0x122): undefined reference to
`QApplication::~QApplication(void)'
/tmp/cczyGE3r.o(.text+0x17f): undefined reference to
`QApplication::~QApplication(void)'
/tmp/cczyGE3r.o: In function `QString::~QString(void)':
/tmp/cczyGE3r.o(.gnu.linkonce.t._._7QString+0x26): undefined reference to
`QString::shared_null'
/tmp/cczyGE3r.o(.gnu.linkonce.t._._7QString+0x2e): undefined reference to
`QString::shared_null'
/tmp/cczyGE3r.o(.gnu.linkonce.t._._7QString+0x3d): undefined reference to
`QStringData::deleteSelf(void)'
collect2: ld returned 1 exit status
jsd at pinky:~$





More information about the Techtalk mailing list