I am trying to use a function from another class but my dependencies seem to be stopping me.
main.cpp
#include "gesture.hpp"
#include "statemachine.hpp"
Gesture g;
StateMachine sm(g);
gesture.hpp
#include "hand.hpp"
statemachine.hpp
#include "gesture.hpp"
StateMachine(Gesture&);
Gesture *g;
What I am trying to accomplish:
I am trying to use a function from the StateMachine sm
that I have declared. This function would be called inside a function in gesture.cpp
and I would be giving my Gesture g
class a pointer to StateMachine sm
. (I would do this after I declare sm
in main) I am able to #include "statemachine.hpp"
in my gesture.cpp
file but I want to move it to gesture.hpp
so I can have it as a pointer that is stored as a variable in that class.
So when I do gesture.hpp
#include "hand.hpp"
#include "statemachine.hpp"
I get the error 'Gesture' does not name a type
and expected ')' before '&' token StateMachine(Gesture&);
Can anyone figure out what is going on? I can't move my function to gesture.cpp
because it uses an array that is stored in my statemachine.hpp