Help!
I’m just starting a new project and trying to create player movement. I’ve done this many times without a problem but this time I got this error: pointer to incomplete class type is not allowed.
I even tried to copy code from previous projects, in which this worked perfectly, but it still doesn’t work…
Here’s the code:
void ARandomPlayerName::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ARandomPlayerName::MoveForward);
}
Can someone help me?
Pointer to Incomplete Class means you’re missing an include.
Add
#include "Components/InputComponent.h"
Why? I never needed that.
Well, probably because of 4.16 right?
Also UCameraComponent? Do I need to include Components/CameraComponent?
Is there a new header for all of those components or do I have include a new one for every single component?
Yes, as Ninjin points out, 4.15/4.16 moved to an Include What You Use (IWYU) model, so you’ll need to manually include headers for objects/components/etc that you use.
But “Components/CameraComponent” doesn’t exist, what’s the header for that?
“Camera/CameraComponent.h”
Thank you, now that I understand what it means your answer really helped me