ich möchte mich endlich mal mit Qt-Programmierung auseinandersetzen und als ich heute die Website von trolltech.com besuchte, viel mir eine Werbung in's Auge, auf welcher ein Ebook vorgestellt wurde...kostenlos. Na, klar, ich hab da sofort runtergeladen und mir gefile bereits das Vorwort.
Ich habe also das erste Beispiel geschnappt und es im Editor eingegeben:
Code: Alles auswählen
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!", 0);
app.setMainWidget(label);
label->show();
return app.exec();
return 0;
}
Code: Alles auswählen
qmake -project
Code: Alles auswählen
qmake
Code: Alles auswählen
avaurus@localhost:~/qt$ make
g++ -o qt hello.o -L/usr/X11R6/lib -lXext -lX11 -lm -lpthread
hello.o(.text+0x1a): In function `main':
: undefined reference to `QApplication::QApplication[in-charge](int&, char**)'
hello.o(.text+0x3c): In function `main':
: undefined reference to `QString::QString[in-charge](char const*)'
hello.o(.text+0x4e): In function `main':
: undefined reference to `QLabel::QLabel[in-charge](QString const&, QWidget*, char const*, unsigned)'
hello.o(.text+0x67): In function `main':
: undefined reference to `QString::shared_null'
hello.o(.text+0x72): In function `main':
: undefined reference to `QStringData::deleteSelf()'
hello.o(.text+0x7f): In function `main':
: undefined reference to `QApplication::setMainWidget(QWidget*)'
hello.o(.text+0x92): In function `main':
: undefined reference to `QApplication::exec()'
hello.o(.text+0x9d): In function `main':
: undefined reference to `QApplication::~QApplication [in-charge]()'
hello.o(.text+0xc0): In function `main':
: undefined reference to `QString::shared_null'
hello.o(.text+0xcb): In function `main':
: undefined reference to `QStringData::deleteSelf()'
hello.o(.text+0xf5): In function `main':
: undefined reference to `QApplication::~QApplication [in-charge]()'
hello.o(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList [in-charge]()'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList [in-charge deleting]()'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QPtrCollection::newItem(void*)'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
hello.o(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
hello.o(.gnu.linkonce.r._ZTI6QGList+0x8): undefined reference to `typeinfo for QPtrCollection'
collect2: ld returned 1 exit status
make: *** [qt] Error 1
Code: Alles auswählen
CONFIG += thread
Hier mal meine qt.pro:
Code: Alles auswählen
######################################################################
# Automatically generated by qmake (1.07a) Sun Dec 5 21:57:12 2004
######################################################################
TEMPLATE = app
CONFIG -= moc
INCLUDEPATH += .
# Input
SOURCES += hello.cpp
So wie es im Buch steht, finde ich es auch im Tutorial von Trolltech wieder, bringt mir also Null .
Ich denke mal, dass ich hier richtig mit meinem Anliegen bin und bedanke mich schonmal vorab für die evtl. gegebene Hilfe .
Mfg, avaurus.
//Nachtrag\\
Code: Alles auswählen
g++ -o hello hello.cpp -Wall -I/usr/lib/qt-3.3.2/include -L/usr/lib/qt-3.3.2/lib -lqt-mt
Danke trotzdem