The weird this is that if I do not include that file, everything compiles just fine and the project works.
Also, if I move the include delaration to the cpp file, that also seems to work fine.
To me, ths seems to be an issue with imports, maybe multiple imports defined or something like that?
Would you have any idea as to why this is happening?
The only thing I can think of is that, throught the project, I always included all the required headers file in the .h files, and not in the .cpp files. Would this be an issue?
I can’t see any issue with the code written in the header file.
Also this class is actually used inside the project and compiles fine if not included in the “pawnBase.h” file.
Then that would be why. You have a circular dependency with that and this is why you should always use forward declarations when you can.
PawnBase.h includes HealthComponent.h which includes TankGameMode.h which includes PawnBase.h which includes HealthComponent.h which includes TankGameMode.h …
That’s kind of the issue here. Judging by the error message HealthComponent isn’t getting the declaration of the game mode
You should only include what the header file needs and forward declare what you can. For example I see that you’re including GamePlayStatics in a header file when it doesn’t use it at all.