View Full Version : problem with an include

20th July 2006, 13:35
hi, I declare QImage qi as private var of mainForm in desinger; then I added #include "qimage.h" in implementation (from desinger). ti gets me error; but it work if I inserted include in declaration (from deisger) why this??? I declared others variabiles in the same way and don't get any errors......

...tor\ui\mainform.h(318): error C2079: 'MainForm::qi' uses undefined class 'QImage'

20th July 2006, 13:45
The compiler must know the exact type of the member variable so it knows how much to allocate memory for the constructed object and so on. There is no way for the compiler of knowing what type is a QImage in the mainform.h file, if you haven't a proper include there. A forward declaration would be sufficient if it was a pointer, though.