Identifier Undefined and type name is not allowed

Got a problem when compiling this section of code.

	// Create a CameraComponent 
	FirstPersonCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->AttachParent = CapsuleComponent;
	// Position the camera a bit above the eyes
	FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 50.0f + BaseEyeHeight);

For the PCIP i get “Error: identifier “PCIP” is undefined” and then for the UCameraComponent i get “type name is not allowed”

New to this so not entirely sure whats happening.
Any ideas would be greatly appreciated.

Thanks in advance!

Your class constructor should be like:

AMyActor::AMyActor(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
    // Create dummy root scene component
    FirstPersonCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FirstPersonCamera0"));
    
    // Rest of your code

}

Cheers,
Moss

Seems my earlier response did not send or something.

Thank you very much Moss. It seems i placed the code inside the topmost function, and not the constructor. Was a late night.

Thanks again Moss. Very much appreciated!

Nice it worked! Make sure to accept the answers so it might help others ^^ The site un-accepts and answer when you add a new comment :smiley: kind a odd hahaha

I am very glad to get this [][1] game platform which is so nice and great.

[1]: