"Invalid use of incomplete type struct Operand forward declaration of struct Operand". i got the same error some days ago, so i asked somewhere but the code was correct and i resolved creating again those files. But now i have again this error and i can't get rid of it :( I have this error in these 2 files.
barrel.h
Expand|Select|Wrap|Line Numbers
- #include "operand.h"
- #include <string>
- using std::string;
- //class Operand; Error in both cases.
- class Barrel: public Operand
- {
- ...
- virtual void empty();
- virtual void fill();
- virtual Barrel* mix(Operand* op2);
- protected:
- double capacity, content, temperature;
- };
Expand|Select|Wrap|Line Numbers
- #include <string>
- #include <QtGui>
- #include "barrel.h"
- #include "calculatorwindow.h"
- #include "operand.h"
- using std::string;
- class CalculatorWindow;
- class Barrel;
- class Operand;
- class Calculator
- {
- public:
- ...
- Operand* operand1;
- Operand* operand2;
- double intoperand;
- string operation;
- string print;
- bool continue;
- ...
- void Fill(CalculatorWindow * calc);
- void Empty(CalculatorWindow * calc);
- Operand* Mix(CalculatorWindow * calc);
- };
operand.h
Expand|Select|Wrap|Line Numbers
- #include <string>
- using std::string;
- class Operand
- {
- public:
- virtual string print();
- virtual Operand* Add(double a);
- virtual void Subtract(double a);
- virtual void empty();
- virtual void fill();
- virtual Operand* mix(Operand* op2);
- };