当前位置: 代码迷 >> QT开发 >> invalid use of incomplete type 'struct Ui:MainWindow如何解决
  详细解决方案

invalid use of incomplete type 'struct Ui:MainWindow如何解决

热度:1209   发布时间:2016-04-25 05:09:37.0
invalid use of incomplete type 'struct Ui::MainWindow怎么解决?
XML code
mainwindow.cpp: In constructor 'MainWindow::MainWindow(QWidget*)': mainwindow.cpp:12: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:14: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:17: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:18: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:19: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp: In destructor 'virtual MainWindow::~MainWindow()': mainwindow.cpp:33: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:34: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:35: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:39: warning: possible problem detected in invocation of delete operator: mainwindow.cpp:39: warning: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: warning: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:39: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined. mainwindow.cpp: In member function 'void MainWindow::on_toolButton_browser_clicked()': mainwindow.cpp:45: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:53: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:54: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp: In member function 'int MainWindow::SearchIntofile(const QString&, const QString&, QTreeWidgetItem*)': mainwindow.cpp:75: warning: unused variable 'i' mainwindow.cpp: In member function 'int MainWindow::FindFile(const QString&)': mainwindow.cpp:111: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:119: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp: In member function 'int MainWindow::search()': mainwindow.cpp:138: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:146: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp: In member function 'int MainWindow::AddFav()': mainwindow.cpp:179: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' mainwindow.cpp:180: error: invalid use of incomplete type 'struct Ui::MainWindow' mainwindow.h:10: error: forward declaration of 'struct Ui::MainWindow' 

我修改了代码,修改了资源文件(把一个菜单的ObjectName改了一下),之后就编译出错了

------解决方案--------------------
看上去你大概是忘了#include "ui_mainwindow.h"
------解决方案--------------------
  相关解决方案