I have three header files (and associated cpp files as well, of course) like the following:
calculator.h:
1 2 3 4 5 6 7 8 9 10 11
|
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include "ui_calculator.h"
class calculator
{
//various standard class stuff here
};
#endif // CALCULATOR_H
| |
ui_calculator.h:
1 2 3 4 5 6 7 8 9
|
#ifndef UI_CALCULATOR_H
#define UI_CALCULATOR_H
#include "calcentrywidget.h"
class Ui_calculator{
//yada yada yada
};
{
| |
and, finally, calcentrywidget.h:
1 2 3 4 5 6 7 8 9
|
#ifndef CALCENTRYWIDGET_H
#define CALCENTRYWIDGET_H
class calcEntryWidget
{
//various class members
};
#endif // CALCENTRYWIDGET_H
| |
This all works well, compiles, runs, everyone is happy. Now I want to add a pointer to a calculator object to my calcEntryWidget class - basically a pointer back to its parent object. So, obviously, I have to add a
#include "calculator.h"
to the calcentrywidget.h file. And everything falls apart - the instant I add that #include, having made no other changes, compilation fails with a
ISO C++ forbids declaration of 'calcEntryWidget' with no type |
error, followed by a slew of other errors stemming, I believe, from that one. What am I missing here? How can I add a calculator pointer to the calcEntryWidget class? Thanks.