Results 1 to 2 of 2

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

  1. #1
    Join Date
    Jan 2013
    Posts
    25
    Thanks
    2
    Platforms
    Windows

    Default invalid use of incomplete type; forward declaration of struct…..from auto-generated c

    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
    Qt Code:
    1. #ifndef REGISTERWIZARDPAGE_H
    2. #define REGISTERWIZARDPAGE_H
    3. #include <QWizardPage>
    4.  
    5. namespace Ui {
    6. class RegisterWizardPage;
    7. }
    8.  
    9. class RegisterWizardPage : public QWizardPage
    10. {
    11. Q_OBJECT
    12.  
    13. public:
    14. explicit RegisterWizardPage(QWidget *parent = 0);
    15. ~RegisterWizardPage();
    16.  
    17. private:
    18. Ui::RegisterWizardPage *ui;
    19. };
    20.  
    21. #endif // REGISTERWIZARDPAGE_H
    To copy to clipboard, switch view to plain text mode 

    RegisterWizardPage.cpp
    Qt Code:
    1. #include "registerwizardpage.h"
    2. #include "ui_registerwizardpage.h"
    3.  
    4. RegisterWizardPage::RegisterWizardPage(QWidget *parent) :
    5. QWizardPage(parent),
    6. ui(new Ui::RegisterWizardPage)
    7. {
    8. ui->setupUi(this);
    9. }
    10.  
    11. RegisterWizardPage::~RegisterWizardPage()
    12. {
    13. delete ui;
    14. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: invalid use of incomplete type; forward declaration of struct…..from auto-generat

    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,
    _

Similar Threads

  1. invalid use of incomplete type 'struct MSG'
    By libed in forum Qt Programming
    Replies: 5
    Last Post: 21st February 2019, 12:32
  2. Replies: 2
    Last Post: 13th October 2012, 16:58
  3. Replies: 9
    Last Post: 29th August 2010, 14:30
  4. error: invalid use of incomplete type 'struct QMetaEnum'
    By dyngoman in forum Qt Programming
    Replies: 3
    Last Post: 12th March 2010, 13:38
  5. Replies: 4
    Last Post: 12th October 2009, 19:36

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.