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

Hello,

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"

UCLASS()
class BASICFPS_API AFPSProjectile : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AFPSProjectile();

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

public:	
	// 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
AFPSProjectile::AFPSProjectile()
{
 	// 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.
	CollisionComponent->InitSphereRadius(15.0f);
	//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->SetUpdatedComponent(CollisionComponent);
	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()
{w
	Super::BeginPlay();
	
}

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

}

the part of the tutorial i’m on:
https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/3/1/index.html