I'm trying to compile a QDialog cpp file that was working before, but now refuses to compile. I even replaced it and the .h with files that came from a default QDialog, but I keep getting these errors:

invalid use of incomplete type 'struct Ui::Dialog'
forward declaration of 'struct Ui::Dialog'
and in Visual Studio:

error C2512: 'Ui::Dialog' : no appropriate default constructor available

Code is below. Anyone know what's wrong here? I'm completely baffled.

Qt Code:
  1. #ifndef DIALOG_H
  2. #define DIALOG_H
  3.  
  4. #include <QDialog>
  5.  
  6. namespace Ui {
  7. class Dialog;
  8. }
  9.  
  10. class Dialog : public QDialog {
  11. Q_OBJECT
  12. public:
  13. Dialog(QWidget *parent = 0);
  14. ~Dialog();
  15.  
  16. protected:
  17. void changeEvent(QEvent *e);
  18.  
  19. private:
  20. Ui::Dialog *ui;
  21. };
  22.  
  23. #endif // DIALOG_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "dialog.h"
  2. #include "ui_dialog.h"
  3.  
  4. Dialog::Dialog(QWidget *parent) :
  5. QDialog(parent),
  6. ui(new Ui::Dialog)
  7. {
  8. ui->setupUi(this);
  9. }
  10.  
  11. Dialog::~Dialog()
  12. {
  13. delete ui;
  14. }
  15.  
  16. void Dialog::changeEvent(QEvent *e)
  17. {
  18. QDialog::changeEvent(e);
  19. switch (e->type()) {
  20. case QEvent::LanguageChange:
  21. ui->retranslateUi(this);
  22. break;
  23. default:
  24. break;
  25. }
  26. }
To copy to clipboard, switch view to plain text mode