小弟由于项目设计的需要 新近才开始学qt
我用的是magic linux
我编译的第一个hello,world程序就出现了问题:
好像是没有连接qt的lib
以下是出错提示
[root@MagicLinux qt]# make
g++ -o qt hello.o -L/usr/X11R6/lib -lXext -lX11 -lm
hello.o: In function `main':
/root/src/qt/hello.cpp:6: undefined reference to `QApplication::QApplication(int&, char**)'
/root/src/qt/hello.cpp:8: undefined reference to `QString::QString(char const*)'
/root/src/qt/hello.cpp:8: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*, char const*)'
hello.o: In function `main':
/usr/lib/qt-3.3/include/qstring.h:847: undefined reference to `QString::shared_null'
/usr/lib/qt-3.3/include/qstring.h:848: undefined reference to `QStringData::deleteSelf()'
hello.o: In function `main':
/root/src/qt/hello.cpp:9: undefined reference to `QPushButton::resize(int, int)'
/root/src/qt/hello.cpp:10: undefined reference to `QApplication::setMainWidget(QWidget*)'
/root/src/qt/hello.cpp:11: undefined reference to `QWidget::show()'
/root/src/qt/hello.cpp:12: undefined reference to `QApplication::exec()'
/root/src/qt/hello.cpp:12: undefined reference to `QPushButton::~QPushButton()'
/root/src/qt/hello.cpp:12: undefined reference to `QApplication::~QApplication()'
hello.o: In function `main':
/usr/lib/qt-3.3/include/qstring.h:847: undefined reference to `QString::shared_null'
/usr/lib/qt-3.3/include/qstring.h:848: undefined reference to `QStringData::deleteSelf()'
hello.o: In function `main':
/root/src/qt/hello.cpp:12: undefined reference to `QApplication::~QApplication()'
/root/src/qt/hello.cpp:12: undefined reference to `QPushButton::~QPushButton()'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0xc): undefined reference to `QGList::clear()'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x10): undefined reference to `QGList::~QGList()'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x14): undefined reference to `QGList::~QGList()'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x18): undefined reference to `QPtrCollection::newItem(void*)'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x20): undefined reference to `QGList::compareItems(void*, void*)'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
hello.o:(.gnu.linkonce.r._ZTV6QGList+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
hello.o:(.gnu.linkonce.r._ZTI6QGList+0x8): undefined reference to `typeinfo for QPtrCollection'
collect2: ld returned 1 exit status
make: *** [qt] 错误 1
[ 此贴被XChinux在2006-03-07 12:41重新编辑 ]