So my latest error is starting to bug me really bad and I've looked around the internet and the best solution I have come up with is that I have a cyclical #include
error, but I'm not sure what is exactly causing that. My include structure looks like the following:
Player.h -includes-> Pawn.h -includes-> Piece.h -includes-> Player.h
I mean, it seems obvious to me that this is a cyclical include problem, but I don't know how to overcome this. To complicate things, class Pawn
extends Piece
, and Piece
has a boost::weak_ptr
back to Player
. The reason my includes looks like this is because Player
has a vector
of Pawn
s (and other Piece
s) but Pawn
also needs to call some of Player
's methods, so I gave the base class Piece a weak_ptr
to Player
for that.
What is a way that I can design this better so that I don't have a cyclical include?