Grüß Euch!
Ich möcht’ mir C+±Kenntnisse im Selbststudium aneignen,
und will auch ein bißchen Grafik reinbringen.
Es besteht aber scheinbar ein Problem beim Kompilieren.
Ich hab den gcc (g++)-Compiler auf Linux laufen.
Zum Beispiel bei folgendem Befehl:
g++ -I /usr/lib/qt/include qhello.cpp -o qhello
(im Pfad nach -I liegen die Header-Files)
erhalt’ ich folgende Fehlermeldungen:
/tmp/ccUUAF1P.o: In function main': /tmp/ccUUAF1P.o(.text+0x1a): undefined reference to
QApplication::QApplication(int &, char **)’
/tmp/ccUUAF1P.o(.text+0x32): undefined reference to QPushButton::QPushButton(char const \*, QWidget \*, char const \*)' /tmp/ccUUAF1P.o(.text+0x48): undefined reference to
QPushButton::resize(int, int)’
/tmp/ccUUAF1P.o(.text+0x5e): undefined reference to QApplication::setMainWidget(QWidget \*)' /tmp/ccUUAF1P.o(.text+0x70): undefined reference to
QWidget::show(void)’
/tmp/ccUUAF1P.o(.text+0x7f): undefined reference to QApplication::exec(void)' /tmp/ccUUAF1P.o(.text+0x95): undefined reference to
QPushButton::~QPushButton(void)’
/tmp/ccUUAF1P.o(.text+0xa6): undefined reference to QApplication::~QApplication(void)' /tmp/ccUUAF1P.o(.text+0xdd): undefined reference to
QPushButton::~QPushButton(void)’
/tmp/ccUUAF1P.o(.text+0xf0): undefined reference to QApplication::~QApplication(void)' /tmp/ccUUAF1P.o: In function
QArrayT type_info function’:
/tmp/ccUUAF1P.o(.gnu.linkonce.t.__tft7QArrayT1Zc+0x10): undefined reference to QGArray type\_info function' /tmp/ccUUAF1P.o(.gnu.linkonce.t.\_\_tft7QArrayT1Zc+0x1a): undefined reference to
QGArray type_info node’
/tmp/ccUUAF1P.o: In function QSenderObject type\_info function': /tmp/ccUUAF1P.o(.gnu.linkonce.t.\_\_tf13QSenderObject+0x10): undefined reference to
QObject type_info function’
/tmp/ccUUAF1P.o(.gnu.linkonce.t.__tf13QSenderObject+0x1a): undefined reference to `QObject type_info node’
collect2: ld returned 1 exit status
Das war der zugehörige Source-Code (aus einem Qt-Tutorial):
// Qt-Test
#include
#include
int main (int argc, char **argv)
{
QApplication a (argc, argv);
QPushButton hello („Hello, World!“);
hello.resize (100,30);
a.setMainWidget (&hello);
hello.show();
return a.exec();
}
Der Jammer ist nun der, daß sich eigentlich nichts außer den
Standardfunktionen (iostream.h, string.h, o. ä.) kompilieren
läßt.
Irgendwas muß da falsch laufen, ich weiß nur nicht was!!!
Ich appelliere an die C++/linux -Experten an euch, die
an den Fehlermeldungen erkennen, was da fehlt!
Danke im voraus, Robert.