For full example, the following main.cpp will both compile and link. Your SubclassE.h does not need to be modified.

Qt Code:
  1. #include <QApplication>
  2. #include "SubclassE.h"
  3.  
  4. class SubclassI : public QWidget
  5. {
  6. Q_OBJECT
  7. public:
  8. SubclassI(QWidget *parent = 0) : QWidget(parent) {} ;
  9.  
  10. } ;
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14. SubclassE e ;
  15. SubclassI i ;
  16. QApplication a(argc, argv);
  17.  
  18. return a.exec();
  19. }
  20.  
  21. #include "main.moc"
To copy to clipboard, switch view to plain text mode 

When run, it produces the following:

Qt Code:
  1. Starting example.exe...
  2. QWidget: Must construct a QApplication before a QPaintDevice
To copy to clipboard, switch view to plain text mode 

Which is expected, as you attempt to create an instance of SubclassE and SubclassI before QApplication.