PDA

View Full Version : Compiling error



Foobar
17th March 2007, 22:47
Hello, I am new to qt and wanted to make a little program. I tried the tutorials at doc.trolltech.com and everything was fine. but then I tried to compile a tutorial file and I got lots of errors that didn't make sense to me and then I tried to compile the "Hello World" and I still got errors. Then I tried to un- and re-install things but nothing changed. I made a complete reinstall of fedora core 6 installed qt and now I still get errors

It is this (http://doc.trolltech.com/3.3/tutorial1-01.html) tutorial
I save it as .cpp
and in console type
qmake -project
qmake
make

and then get:
g++ -o qt qt.o -lXext -lX11 -lm
qt.o: In function `main':
/home/foobar/qt/qt.cpp:13: undefined reference to `QApplication::QApplication(int&, char**)'
/home/foobar/qt/qt.cpp:15: undefined reference to `QString::QString(char const*)'
/home/foobar/qt/qt.cpp:15: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*, char const*)'
qt.o: In function `~QString':
/usr/lib64/qt-3.3/include/qstring.h:847: undefined reference to `QString::shared_null'
/usr/lib64/qt-3.3/include/qstring.h:848: undefined reference to `QStringData::deleteSelf()'
qt.o: In function `main':
/home/foobar/qt/qt.cpp:16: undefined reference to `QPushButton::resize(int, int)'
/home/foobar/qt/qt.cpp:18: undefined reference to `QApplication::setMainWidget(QWidget*)'
/home/foobar/qt/qt.cpp:19: undefined reference to `QWidget::show()'
/home/foobar/qt/qt.cpp:20: undefined reference to `QApplication::exec()'
/home/foobar/qt/qt.cpp:20: undefined reference to `QPushButton::~QPushButton()'
/home/foobar/qt/qt.cpp:20: undefined reference to `QApplication::~QApplication()'
qt.o: In function `~QString':
/usr/lib64/qt-3.3/include/qstring.h:847: undefined reference to `QString::shared_null'
/usr/lib64/qt-3.3/include/qstring.h:848: undefined reference to `QStringData::deleteSelf()'
qt.o: In function `main':
/home/foobar/qt/qt.cpp:20: undefined reference to `QApplication::~QApplication()'
/home/foobar/qt/qt.cpp:20: undefined reference to `QPushButton::~QPushButton()'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x18): undefined reference to `QGList::clear()'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x20): undefined reference to `QGList::~QGList()'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x28): undefined reference to `QGList::~QGList()'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x30): undefined reference to `QPtrCollection::newItem(void*)'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x40): undefined reference to `QGList::compareItems(void*, void*)'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x48): undefined reference to `QGList::read(QDataStream&, void*&)'
qt.o:(.rodata._ZTV6QGList[vtable for QGList]+0x50): undefined reference to `QGList::write(QDataStream&, void*) const'
qt.o:(.rodata._ZTI6QGList[typeinfo for QGList]+0x10): undefined reference to `typeinfo for QPtrCollection'
collect2: ld returned 1 exit status
make: *** [qt] Error 1

Anybody have an idea what's wrong?

jacek
17th March 2007, 22:54
Add "TARGET = something" to your .pro file or rename it to something other than qt.pro and run "qmake && make".

Foobar
17th March 2007, 23:02
Thank you
This worked with and without renaming the pro file