c/c++ include conflict
Hii, I have two .h files one name x and one name y
I want to do in x #include "y.h" and in y I need to define an x type so I need #include "x.h" but then when compiling my make file I get an error ISO C++ forbids declaration of 'X' with no type what can I do please? |
in x u include types from y and in y from x...
That's a problem... try to separete the things u declare in x which included in y in a different header z (or those of y in x) and include z instead.. or in a way that x won;t need y to define itsown types and vice versa |
You can also add a forward declaration.
in X you might have: class Y; class X{... private: Y * myY, ...}; #include "y.h" and in Y you might have: class X; class Y{... private: X * myX, ...}; #include "x.h" |
Quote:
|
All times are GMT -5. The time now is 04:03 PM. |