PDA

View Full Version : Error declaring Qt object



Doug Broadwell
9th September 2007, 21:59
If I try to declare a QDirModel pointer in my class declaration in my header (QDirMidel* pDirModel), I get the error "ISO C++ forbids declaration of 'QDirModel' with no type".

If I declare other objects (e.g., QPainter* pPainter), I get no such error.

???
Thanks

marcel
9th September 2007, 22:06
Try a forward declaration at the beginning of your header, after the include section:


class QDirModel;


Note that in the cpp you have to include QDirModel.

Regards

jpn
9th September 2007, 22:06
Depending on your needs, either forward declare:

class QDirModel;
or include the header:

#include <QDirModel>

Doug Broadwell
9th September 2007, 22:15
Thanks very much !