PDA

View Full Version : invalid use of incomplete type; forward declaration of struct…..from auto-generated c



tesmai4
18th July 2014, 13:49
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(QWid get*)’:

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_OBJECT

public:
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;
}

anda_skoa
18th July 2014, 14:38
Check the generated ui_registerwizardpage.h file if it does indeed define the class name you are looking for.

Maybe you changed the Form's name after the orignal code for RegisterWizardPage.h/.cpp was created.

Cheers,
_