On Mon, Jul 16, 2001 at 05:31:46PM +0200, Steffen Liebergeld wrote:
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 );
...
Ein "stepardo@linux:~/c++ > g++ -I /usr/lib/qt-2.3.0/include/ qthello.cpp"
Aha. Du willst nicht nur compilieren sondern compilieren und linken. Nur compilieren geht mit $ g++ -c -I /usr/lib/qt-2.3.0/include/ qthello.cpp
Wenn du gleich mit linken willst musst du auch noch die Bibliotheken mit angeben, die hinzugelinkt werden müssen (dort sind die ganzen undefinierten Dinge drin) Um eine shared lib hinzuzulinken gibst du dem Compiler einfach ein -lNAME_DER_LIB mit, also z.b. -lqt für die qt-lib. Falls der linker die library nicht findent, musst du dann noch den Pfad zu dieser Lib angeben mit -L/pfad/zur/lib Wenn also qt in /usr/local/qt installiert ist, wirst du etwas folgendes sagen müssen:
$ g++ -I/usr/local/qt/include -L/usr/local/qt/lib -lqt qthello.cpp
Wenn alles geklappt hat, ist das fertige Binary in in ./a.out zu finden. Damit der ld.so zur Laufzeit von a.out die qt-lib findet, trägt man entweder /usr/local/qt/lib mit in /etc/ld.so.conf ein und startet ldconfig oder aber man schreibt den Suchpfad zur Bibliothek mit ins binary rein (-R/pfad/)
$ g++ -I/usr/local/qt/include -L/usr/local/qt/lib -lqt \ -R/usr/local/qt/lib qthello.cpp
Reinhard (der Rechner haßt, bei den ohne gesetztes $LD_LIBRARY_PATH die Hälfte nicht funktioniert)
Damit de
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?
-- Ave´ Stepardo
-Linux: It's really celebrating a freedom of expression, it's celebrating creativity, it's celebrating innovation, it's celebrating collaboration, and it's definitely celebrating community
Homepage: http://www.steffen-liebergeld.de ICQ: 70976920 (selten benutzt)
Lug-dd maillist - Lug-dd@schlittermann.de http://mailman.schlittermann.de/mailman/listinfo/lug-dd