c++ - pointer variable of class 'Entity' within class 'Component', gives errors even though 'Entity.h' has been included -
okay i'm making own entity component system, , i'm trying have entity pointer object within component class, object(variable) gives me ton of errors, though has been included.
'component.h' #include "entity.h" class component { public: entity* thisentity; }
that doesn't work, , gives me 76 errors inside 'entity.h', of don't recognize custom types(like component, string, etc). use global header file has global variables, , includes necessary, this:
'public.h' #ifndef entity_h #include "entity.h" // entity include guarded #endif
when try include 'public.h' inside 'component.cpp' still gives me errors:
'component.cpp' #include "public.h" #include "component.h" // arrangement correct, public before component still doesn't work
when hover on pointer variable "entity* thisent" shows me "entity class", recognizes still gives me 76 errors.
you can not refer header files each other creates cyclical dependency. can break dependency forward declaring 1 of classes want use.
Comments
Post a Comment