Invalid use of incomplete type; forward declaration of struct.....from auto-generated code
-
Dear all,
I created a "QWizardPage form class" in my project. I get the following errors from the auto-generated code:
registerwizardpage.cpp: In constructor 'RegisterWizardPage::RegisterWizardPage(QWidget*)':
registerwizardpage.cpp:6: error: invalid use of incomplete type 'struct Ui::RegisterWizardPage'
registerwizardpage.h:7: error: forward declaration of 'struct Ui::RegisterWizardPage'
registerwizardpage.cpp:8: error: invalid use of incomplete type 'struct Ui:RegisterWizardPage'
registerwizardpage.h:7: error: forward declaration of 'struct Ui::RegisterWizardPage'
registerwizardpage.cpp: In destructor 'virtual RegisterWizardPage::~RegisterWizardPage()':
registerwizardpage.cpp:13: warning: possible problem detected in invocation of delete operator:
registerwizardpage.cpp:13: warning: invalid use of incomplete type 'struct Ui::RegisterWizardPage'
registerwizardpage.h:7: warning: forward declaration of 'struct Ui::RegisterWizardPage'Any help for resolving this error please.
RegisterWizardPage.h
@#ifndef REGISTERWIZARDPAGE_H
#define REGISTERWIZARDPAGE_H#include <QWizardPage>
namespace Ui {
class RegisterWizardPage;
}class RegisterWizardPage : public QWizardPage
{
Q_OBJECTpublic:
explicit RegisterWizardPage(QWidget *parent = 0);
~RegisterWizardPage();private:
Ui::RegisterWizardPage *ui;
};#endif // REGISTERWIZARDPAGE_H
@RegisterWizardPage.cpp
@#include "registerwizardpage.h"
#include "ui_registerwizardpage.h"RegisterWizardPage::RegisterWizardPage(QWidget *parent) :
QWizardPage(parent),
ui(new Ui::RegisterWizardPage)
{
ui->setupUi(this);
}RegisterWizardPage::~RegisterWizardPage()
{
delete ui;
}
@ -
Hope you did not change the objectName of Wizard in Designer.
In order to check this, can you create new project for the same type of wizard and don't change any parameters/properties in designer form.
Now compile and run. See if you observe the same errors. -
Thanks for your reply.
I did change the objectName of QWizard instance in QT Designer. I did not change any parameters.
I did clean my project and executed QMake before build all.
How can I correct/avoid this error?Why and how is it important to not the change name of QWizard in designer?
-
Following code snippet depends on objectName
@namespace Ui {
class WizardPage;
}and
private:
Ui::WizardPage *ui;
@ -
Thanks for your reply. Problem solved.
Could you please have a look at this "issue":https://qt-project.org/forums/viewthread/45125/
Regards,