Cannot initialize UChildActorComponent in C++, 4.7

So I have this in my header:

class UChildActorComponent* childActor;
public:
AThirdPersonPlayerController(const FObjectInitializer& ObjectInitializer);

And this in my cpp file:

AThirdPersonPlayerController::AThirdPersonPlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
childActor = CreateDefaultSubobject(TEXT(“ChildActor”));
}

I’m getting these errors:
error C2027: use of undefined type ‘UChildActorComponent *’
error C2440: ‘static_cast’ : cannot convert from ‘UObject *’ to ‘UChildActorComponent *’

I’m working in C++ in ue4 4.7.2. Am I initializing it incorrectly?

Hi,

This is the important part:

error C2027: use of undefined type 'UChildActorComponent'

You need to include the “Components/ChildActorComponent.h” header in your .cpp file.

Steve

Thanks Steve!