i cannot seem to get this one working.
whenever i move the #include “Tank.h” to the Tankplayercontroller.cpp, it gives me this error in unreal (no intellisense issue though):
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\TankPlayerController.h(23) : error C2143: syntax error: missing ‘;’ before ‘*’
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\TankPlayerController.h(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\TankPlayerController.h(23) : error C2238: unexpected token(s) preceding ‘;’
there is no such syntax error because everything works fine when the include in the .h file.
same issue if i move the #include “TankPlayerController.h” from tank.h to tank.cpp.
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\Tank.h(24) : error C2143: syntax error: missing ‘;’ before ‘*’
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\Tank.h(24) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CompilerResultsLog: Error: C:\Unreal Projects\UnrealTankGame\BattleTank\Source\BattleTank\Tank.h(24) : error C2238: unexpected token(s) preceding ‘;’
the lines in question are:
ATank * GetControlledTank() const; // in tankplayercontroller.h
UTankAimingComponent * TankAimingComponent = nullptr; // in tank.h
i honestly dont understand how it Should work, as in - how can the compiler know what ATank/UTankAimingComponent is if its not declared anywhere in the file.h, but instead declared in the cpp file that includes this one? is this somehow gets rearranged in the .obj file?