You have circular includes here:
AlghoritmState.hpp
is #include
ing FaceRegion.hpp
and vice versa. With include guards this means that one header will see the other, but not the other way.
Your problem is that you use both AlghoritmState
in the FaceRegion
and the other way around. The AlghoritmState
is a interface, so you should drop the member variable there and add it to the implementation, the HaarClassifierState
In that way you include like this:
FaceRegion
includeAlghoritmState
HaarClassifierState
includeFaceRegion
andAlghoritmState
as you can see, you have no more cycles and you compilation problems will be gone.
Important: You are currently storing objects by value. When you do that with inherited objects they are prone to slicing which means that you might end up with a object that is smaller that it should be, leading to nasty stuff happening (UB). So you should in all cases stop storing objects super classes as values, and store them as pointers instead. (which ofcourse leads us to the problems of ownership of the variable, but that is for another question). So only have member variables of a super type if it is the actual super type that is stored there.