当前位置: 技术问答>linux和unix
急急急!Kdevelop开发QT错误!大家帮帮忙!
来源: 互联网 发布时间:2016-11-13
本文导语: 源程序: #include #include #include #include "ui_exit.h" int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QTextCodec::setCodecForTr(QTextCodec::codecForName("gb2312")); // Q_INIT_RESOURCE(findfile); Q...
源程序:
#include
#include
#include
#include "ui_exit.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb2312"));
// Q_INIT_RESOURCE(findfile);
QWidget *pWidget = new QWidget;
Ui::exit ui;
ui.setupUi(pWidget);
pWidget->show();
return app.exec();
}
错误信息:
cd '/home/qiang/projects/qt4/my001' && LC_MESSAGES="C" LC_CTYPE="C" make clean && LC_MESSAGES="C" LC_CTYPE="C" make
cd src/ && make -f Makefile clean
进入目录 /home/qiang/projects/qt4/my001/src
rm -f ui_exit.h
rm -f main.o
rm -f *~ core *.core
退出目录 /home/qiang/projects/qt4/my001/src
进入目录 /home/qiang/projects/qt4/my001
cd src/ && make -f Makefile
进入目录 /home/qiang/projects/qt4/my001/src
正在生成 ui_exit.h (uic)
正在编译 main.cpp (g++)
正在连接 ../bin/my001 (g++)
main.o: In function `main':
main.cpp:(.text+0x8d): undefined reference to `QWidget::QWidget(QWidget*, QFlags)'
main.cpp:(.text+0x10f): undefined reference to `QWidget::resize(QSize const&)'
main.cpp:(.text+0x129): undefined reference to `QPushButton::QPushButton(QWidget*)'
main.cpp:(.text+0x18f): undefined reference to `QWidget::setGeometry(QRect const&)'
main.cpp:(.text+0x1c9): undefined reference to `QWidget::setWindowTitle(QString const&)'
main.cpp:(.text+0x214): undefined reference to `QAbstractButton::setText(QString const&)'
collect2: ld returned 1 exit status
退出目录 /home/qiang/projects/qt4/my001/src
进入目录 /home/qiang/projects/qt4/my001
make[1]: *** [../bin/my001] Error 1
make: *** [sub-src-make_default] Error 2
*** 退出状态:2 ***
#include
#include
#include
#include "ui_exit.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb2312"));
// Q_INIT_RESOURCE(findfile);
QWidget *pWidget = new QWidget;
Ui::exit ui;
ui.setupUi(pWidget);
pWidget->show();
return app.exec();
}
错误信息:
cd '/home/qiang/projects/qt4/my001' && LC_MESSAGES="C" LC_CTYPE="C" make clean && LC_MESSAGES="C" LC_CTYPE="C" make
cd src/ && make -f Makefile clean
进入目录 /home/qiang/projects/qt4/my001/src
rm -f ui_exit.h
rm -f main.o
rm -f *~ core *.core
退出目录 /home/qiang/projects/qt4/my001/src
进入目录 /home/qiang/projects/qt4/my001
cd src/ && make -f Makefile
进入目录 /home/qiang/projects/qt4/my001/src
正在生成 ui_exit.h (uic)
正在编译 main.cpp (g++)
正在连接 ../bin/my001 (g++)
main.o: In function `main':
main.cpp:(.text+0x8d): undefined reference to `QWidget::QWidget(QWidget*, QFlags)'
main.cpp:(.text+0x10f): undefined reference to `QWidget::resize(QSize const&)'
main.cpp:(.text+0x129): undefined reference to `QPushButton::QPushButton(QWidget*)'
main.cpp:(.text+0x18f): undefined reference to `QWidget::setGeometry(QRect const&)'
main.cpp:(.text+0x1c9): undefined reference to `QWidget::setWindowTitle(QString const&)'
main.cpp:(.text+0x214): undefined reference to `QAbstractButton::setText(QString const&)'
collect2: ld returned 1 exit status
退出目录 /home/qiang/projects/qt4/my001/src
进入目录 /home/qiang/projects/qt4/my001
make[1]: *** [../bin/my001] Error 1
make: *** [sub-src-make_default] Error 2
*** 退出状态:2 ***
|
c++ 源程序 -o prg -Ld /你系统的路径/libqt-mt.so
其中libqt-mt.so是Qt运行共享库,具体你自己系统你仔细分辨清楚。
其中libqt-mt.so是Qt运行共享库,具体你自己系统你仔细分辨清楚。