For full example, the following main.cpp will both compile and link. Your SubclassE.h does not need to be modified.
#include <QApplication>
#include "SubclassE.h"
{
Q_OBJECT
public:
} ;
int main(int argc, char *argv[])
{
SubclassE e ;
SubclassI i ;
return a.exec();
}
#include "main.moc"
#include <QApplication>
#include "SubclassE.h"
class SubclassI : public QWidget
{
Q_OBJECT
public:
SubclassI(QWidget *parent = 0) : QWidget(parent) {} ;
} ;
int main(int argc, char *argv[])
{
SubclassE e ;
SubclassI i ;
QApplication a(argc, argv);
return a.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
When run, it produces the following:
Starting example.exe...
Starting example.exe...
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.
Bookmarks