The problem is that your ui property uses the declaration of the Ui::MainWindowClass , therefore, an "incomplete type" error.
Including the header file in which this class is declared will fix the problem.
EDIT
Based on your comment, the following code:
namespace Ui { class MainWindowClass; }
does NOT declare a class. This is a forward declaration , which means that the class will exist at some point during the link.
Basically, it simply tells the compiler that the type will exist and that it should not warn about it.
But the class must be defined somewhere .
Please note that this can only work if you have a pointer .
You cannot have a statically allocated instance of an incomplete type.
So, either you really want an incomplete type, and then you have to declare your ui -rent as a pointer:
namespace Ui {
Or you need a statically allocated instance of Ui::MainWindowClass , and then it must be declared. You can do this in another header file (usually there is one header file for each class).
But just changing the code to:
namespace Ui {
will also work.
Note the difference between the two ads. First, a forward declaration is used, and the second actually declares the class (here without properties and methods).
Macmade Sep 17 '12 at 19:44 2012-09-17 19:44
source share