Two things Ben Tristem

First off you left your forward declaration misspelled in your TankPlayerController.h. It still says " class UTankTankAimingComponent " yet somehow you are still able to compile. I have followed your code word for word, and yet after adding the lines in the TankPlayerController.cpp file " void ATankPlayerController::BeginPlay()
auto AutoComponent = GetControlledTank()->FindComponentByClass();
if (AimingComponent)
UE_LOG(LogTemp, Warning, TEXT(“Player Controller can’t find aiming component at begin play”))
} "
I am continuesly getting a failed compilation error that reads this " 1>C:\Users\agtsk\Documents\C++UE4 Course Projects\04_BattleTank\BattleTank\Source\BattleTank\TankPlayerController.cpp(14): error C2065: ‘AimingComponent’: undeclared identifier
1>C:\Users\agtsk\Documents\C++UE4 Course Projects\04_BattleTank\BattleTank\Source\BattleTank\TankPlayerController.cpp(16): error C2065: ‘AimingComponent’: undeclared identifier "

I have gone over everything a hundred times, and there are no spelling mistakes i can see. So i am completely baffled as to why your code is compiling with a misspelled forward declaration and all of the same code i have. While mine with a proper spelled forward declaration and the same code you have is not compiling…

This is my TankPlayerController.cpp file

This is my TankPlayerController.h file

Figured out what i did wrong, but i still don’t understand how yours compiled.

Privacy & Terms