'Plansza' : undeclared identifier
I don’t know why i get this error. I have 2 classes called “Plansza” and “GameData”, i have included both headers( in Plansza.h included “GameData.h” and it’s works, but when I include “Plansza.h” in GameData.h it does not see Plansza class :S
‘Plansza’ : undeclared identifier I don’t know why i get this error. I have
Share
When you include
A.hinB.hand ALSO the other way around, you setup a circular dependence. If you had include guards, one of them gets lost and such errors occur.What you want to do is try hard to include
.hfiles in the.cppfiles as far as possible, and if this is not possible, reduce the 2 way dependence into a 1 way dependence.Try as often as possible to use forward declarations in the
.hfiles, as long as you are using only pointers to the class, this will suffice.instead of
Edit: Thanks user1701595 for a very good reference – Organizing Code Files in C and C++