QT程序中QDockWidget这个函数报错
闪电侠风行 2012-03-18 01:27:38 这个错误是在编译是报的,在主函数中没有QDockWidget这个函数,只是在qdesigner中拖放了一个,
在qt4.5.2中编译可以同过,但是我想将它编译成可以在开发板上运行的程序,确出现了上面的错误。
主函数代码:
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDockWidget>
#include <QtGui>
#include <QPushButton>
#include <QSqlDatabase>
#include "querysystem.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QSqlDatabase db,QString accountStr,QWidget *parent = 0);
~MainWindow();
private slots:
void chaxunxitong();
private:
Ui::MainWindow *ui;
QSqlDatabase db;
QString accountStr;
querysystem* chaxunxitong1;
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QSqlDatabase db,QString accountStr,QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->db = db;
this->accountStr = accountStr;
connect(ui->chaxunxitong,SIGNAL(clicked()),this,SLOT(chaxunxitong()));
}
void MainWindow::chaxunxitong(){
chaxunxitong1 = new querysystem(db,accountStr,this);
setCentralWidget(chaxunxitong1);
}
MainWindow::~MainWindow()
{
delete ui;
}
In file included from mainwindow.cpp:2:
ui_mainwindow.h: In member function ‘void Ui_MainWindow::setupUi(QMainWindow*)’:
ui_mainwindow.h:75: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:76: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:77: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:78: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:79: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:101: error: invalid use of incomplete type ‘struct QDockWidget’
/witech/builddir/sdk/qtopiacore/target/include/QtGui/qmainwindow.h:59: error: forward declaration of ‘struct QDockWidget’
ui_mainwindow.h:102: error: ‘class QMainWindow’ has no member named ‘addDockWidget’
make: *** [mainwindow.o] 错误 1
在编译的时候出现了这个问题,困扰了我一晚上了,找了很多的资料,不知道怎么解决,希望能够帮忙解决,万分感谢……