在KDEVELOP 中编译QT4程序出现
cd '/home/scarlett/Project/hello' && LC_MESSAGES="C" LC_CTYPE="C" gmake -k
cd src/ && gmake -f Makefile
正在编译 main.cpp (g++)
正在连接 ../bin/hello (g++)
main.o: In function `main':
/home/scarlett/Project/hello/src/main.cpp:32: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*)'
main.o: In function `QWidget::resize(int, int)':
/usr/include/QtGui/qwidget.h:996: undefined reference to `QWidget::resize(QSize const&)'
main.o: In function `main':
/home/scarlett/Project/hello/src/main.cpp:34: undefined reference to `QPushButton::setFlat(bool)'
/home/scarlett/Project/hello/src/main.cpp:37: undefined reference to `QPushButton::~QPushButton()'
/home/scarlett/Project/hello/src/main.cpp:37: undefined reference to `QPushButton::~QPushButton()'
collect2: ld returned 1 exit status
gmake[1]: *** [../bin/hello] Error 1
gmake[1]: Target `first' not remade because of errors.
gmake: *** [sub-src-make_default] Error 2
gmake: Target `first' not remade because of errors.
*** 退出状态:2 ***
源代码为
#include<QtCore/QTextCodec>
#include <QCoreApplication>
#include<QtGui/QPushButton>
#include<QtGui/QApplication>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
qDebug("Hello from Qt 4!");
QPushButton button("Hello world",NULL);
button.resize(400,300);
button.setFlat(true);
QObject::connect(&button,SIGNAL(clicked()),&app,SLOT(quit()));
button.show();
return app.exec();
}
这是为什么,怎么办啊??大神们帮帮忙吧。。