Hi,
I have a problem compiling my first "Hello World" program with qmake. I am using QT 3.3.4 with Debian Sarge and gcc 3.3.5. I first compiled the Qt-Tutorial 1 from the Trolltech website by directly calling gcc without any problems:
gcc -o qt1 main.cpp -I$QTDIR/include -L$QTDIR/lib -lqt-mt
gcc -o qt1 main.cpp -I$QTDIR/include -L$QTDIR/lib -lqt-mt
To copy to clipboard, switch view to plain text mode
Next I wanted to follow the direction from the tutorial and use qmake:
qmake -project
qmake
make
qmake -project
qmake
make
To copy to clipboard, switch view to plain text mode
The last call to make gave me a long list of errors:
g++ -o qt main.o -L/usr/X11R6/lib -lXext -lX11 -lm
main.o(.text+0x30): In function `main':
: undefined reference to `QApplication::QApplication[in-charge](int&, char**)'
main.o(.text+0x41): In function `main':
: undefined reference to `QString::QString[in-charge](char const*)'
main.o(.text+0x5f): In function `main':
: undefined reference to `QPushButton::QPushButton[in-charge](QString const&, QWidget*, char const*)'
main.o(.text+0x74): In function `main':
: undefined reference to `QString::shared_null'
main.o(.text+0x7e): In function `main':
: undefined reference to `QStringData::deleteSelf()'
main.o(.text+0xa6): In function `main':
: undefined reference to `QPushButton::resize(int, int)'
main.o(.text+0xb2): In function `main':
: undefined reference to `QApplication::setMainWidget(QWidget*)'
main.o(.text+0xba): In function `main':
: undefined reference to `QWidget::show()'
main.o(.text+0xc2): In function `main':
: undefined reference to `QApplication::exec()'
main.o(.text+0xcc): In function `main':
: undefined reference to `QPushButton::~QPushButton [in-charge]()'
main.o(.text+0xd4): In function `main':
: undefined reference to `QApplication::~QApplication [in-charge]()'
...
g++ -o qt main.o -L/usr/X11R6/lib -lXext -lX11 -lm
main.o(.text+0x30): In function `main':
: undefined reference to `QApplication::QApplication[in-charge](int&, char**)'
main.o(.text+0x41): In function `main':
: undefined reference to `QString::QString[in-charge](char const*)'
main.o(.text+0x5f): In function `main':
: undefined reference to `QPushButton::QPushButton[in-charge](QString const&, QWidget*, char const*)'
main.o(.text+0x74): In function `main':
: undefined reference to `QString::shared_null'
main.o(.text+0x7e): In function `main':
: undefined reference to `QStringData::deleteSelf()'
main.o(.text+0xa6): In function `main':
: undefined reference to `QPushButton::resize(int, int)'
main.o(.text+0xb2): In function `main':
: undefined reference to `QApplication::setMainWidget(QWidget*)'
main.o(.text+0xba): In function `main':
: undefined reference to `QWidget::show()'
main.o(.text+0xc2): In function `main':
: undefined reference to `QApplication::exec()'
main.o(.text+0xcc): In function `main':
: undefined reference to `QPushButton::~QPushButton [in-charge]()'
main.o(.text+0xd4): In function `main':
: undefined reference to `QApplication::~QApplication [in-charge]()'
...
To copy to clipboard, switch view to plain text mode
What makes me suspicious is the first line containing a call to gcc, using X11 libraries and not Qt libraries...
Bookmarks