(collisionComponent/projectileMovement component) pointer to incomplete class type is not allowed


I think I would give the Engine.h file a chance. :slight_smile:

And you can add the Engine.h file in your ProjectName.h under the CoreMinimal.h. After this in your AFBSProjectile change the CoreMinimal.h include to ProjectName.h and this should work.

After this you can also remove the class in front of your Components.

Im not sure but you can give it a try. :slight_smile:

i’m following the unreal basic fps tutorial on the documentation, and have come across a bug whilst coding the collision component and projectileMovement component. as stated in the title it is for both components, saying that "incomplete pointer to class type is not allowed.

after reading around I’ve come to the conclusion that i’m missing header files, but the problem is: which ones?#

my projectile header file:
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "FPSProjectile.generated.h"

class BASICFPS_API AFPSProjectile : public AActor
	// Sets default values for this actor's properties

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	// Called every frame
	virtual void Tick(float DeltaTime) override;

	//sphere component for the projectile.
	UPROPERTY(VisibleDefaultsOnly, category = Projectile)
	class USpehreComponent * CollisionComponent;

	//movement component for the projectile.
	UPROPERTY(VisibleDefaultsOnly, Category = Movement)
	class UProjectileMovementComponent * ProjectileMovementComponent;


the projectile source file:

#include "FPSProjectile.h"
#include "Collision.h"

// Sets default values
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//we're using a sphere as a visual represebtation for the projectile.
	CollisionComponent = CreateDefaultSubobject<USpehreComponent>(TEXT("Collision component"));
	//set the collision radius of the sphere.
	//set root component to the sphere component.
	RootComponent = CollisionComponent;

	//ProjectileMovementComponent will be responsible for the movement oof the projectile.
	ProjectileMovementComponent = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile movement component"));
	ProjectileMovementComponent->InitialSpeed = 3000.0f;
	ProjectileMovementComponent->MaxSpeed = 3000.0f;
	ProjectileMovementComponent->bRotationFollowsVelocity = true;
	ProjectileMovementComponent->bShouldBounce = true;
	ProjectileMovementComponent->Bounciness = 0.3f;

// Called when the game starts or when spawned
void AFPSProjectile::BeginPlay()

// Called every frame
void AFPSProjectile::Tick(float DeltaTime)


the part of the tutorial i’m on: