Hallo,
erstmal danke für die vielen Ratschläge. Ich habe jetzt dem g++ (und probeweise auch dem c++) mittels der -I Option den Standort der QT Headers mitgeteilt. Da nun jedoch erst recht seltsamme Fehlermeldungen kommen, muss ich leider nochmal eure Hilfe in Anspruch nehmen:
Das Programm sieht wie folgt aus:
#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(); }
Es ist im Prinzip das Programm aus dem Tutorial von Trolltech. Es sollte also zumindest programmiertechnisch in Ordnung sein.
Ein "stepardo@linux:~/c++ > g++ -I /usr/lib/qt-2.3.0/include/ qthello.cpp" endet aber immer nach einer ganzen Weile des Rechnens mit folgender Fehlermeldung:
/tmp/ccXTPELh.o: In function `main': /tmp/ccXTPELh.o(.text+0x1a): undefined reference to `QApplication::QApplication(int &, char **)' /tmp/ccXTPELh.o(.text+0x31): undefined reference to `QString::QString(char const *)' /tmp/ccXTPELh.o(.text+0x4d): undefined reference to `QPushButton::QPushButton(QString const &, QWidget *, char const *)' /tmp/ccXTPELh.o(.text+0x83): undefined reference to `QPushButton::resize(int, int)' /tmp/ccXTPELh.o(.text+0x99): undefined reference to `QApplication::setMainWidget(QWidget *)' /tmp/ccXTPELh.o(.text+0xab): undefined reference to `QWidget::show(void)' /tmp/ccXTPELh.o(.text+0xba): undefined reference to `QApplication::exec(void)' /tmp/ccXTPELh.o(.text+0xd0): undefined reference to `QPushButton::~QPushButton(void)' /tmp/ccXTPELh.o(.text+0xe1): undefined reference to `QApplication::~QApplication(void)' /tmp/ccXTPELh.o(.text+0x12d): undefined reference to `QPushButton::~QPushButton(void)' /tmp/ccXTPELh.o(.text+0x140): undefined reference to `QApplication::~QApplication(void)' /tmp/ccXTPELh.o(.rodata+0xb8): undefined reference to `QDropEvent type_info node' /tmp/ccXTPELh.o: In function `QArray<char> type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tft6QArray1Zc+0x10): undefined reference to `QGArray type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tft6QArray1Zc+0x1a): undefined reference to `QGArray type_info node' /tmp/ccXTPELh.o: In function `QTimerEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QTimerEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QTimerEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QMouseEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QMouseEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QMouseEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QWheelEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QWheelEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QWheelEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QKeyEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf9QKeyEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf9QKeyEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QFocusEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QFocusEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QFocusEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QPaintEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QPaintEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QPaintEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QMoveEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QMoveEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QMoveEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QResizeEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf12QResizeEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf12QResizeEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QCloseEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QCloseEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QCloseEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QShowEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QShowEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QShowEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QHideEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QHideEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf10QHideEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QDragMoveEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf14QDragMoveEvent+0x10): undefined reference to `QDropEvent type_info function' /tmp/ccXTPELh.o: In function `QDragResponseEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf18QDragResponseEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf18QDragResponseEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QDragLeaveEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf15QDragLeaveEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf15QDragLeaveEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QChildEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QChildEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf11QChildEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QCustomEvent type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf12QCustomEvent+0x10): undefined reference to `QEvent type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf12QCustomEvent+0x1a): undefined reference to `QEvent type_info node' /tmp/ccXTPELh.o: In function `QSenderObject type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf13QSenderObject+0x10): undefined reference to `QObject type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tf13QSenderObject+0x1a): undefined reference to `QObject type_info node' /tmp/ccXTPELh.o: In function `QIntDict<void> type_info function': /tmp/ccXTPELh.o(.gnu.linkonce.t.__tft8QIntDict1Zv+0x10): undefined reference to `QGDict type_info function' /tmp/ccXTPELh.o(.gnu.linkonce.t.__tft8QIntDict1Zv+0x1a): undefined reference to `QGDict type_info node' /tmp/ccXTPELh.o: In function `QString::~QString(void)': /tmp/ccXTPELh.o(.gnu.linkonce.t._._7QString+0x26): undefined reference to `QString::shared_null' /tmp/ccXTPELh.o(.gnu.linkonce.t._._7QString+0x2e): undefined reference to `QString::shared_null' /tmp/ccXTPELh.o(.gnu.linkonce.t._._7QString+0x3d): undefined reference to `QStringData::deleteSelf(void)' collect2: ld returned 1 exit status
Also muss irgendwo unterwegs etwas nicht ganz richtig gelaufen sein. Aber was?