I tried to write a projectile class for my ARPG project. But it output error like these, i search some same problem and it shows "UShapeComponent gives the error ‘identifier is undefined’
2>Performing 3 actions (2 in parallel)
2>Projectile.cpp
2>WinterBattle.generated.cpp
2>e:\winterbattle\winterbattle\source\winterbattle\Projectile.h(25): error C2143: ???: ??“;”(?““???)
2>e:\winterbattle\winterbattle\source\winterbattle\Projectile.h(25): error C4430: ??? - ??? int???: C++ ??? int
2>e:\winterbattle\winterbattle\source\winterbattle\Projectile.h(25): error C2238: ???”;“??
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.cpp(13): error C2065: “CollisionComponent”: ???
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.cpp(14): error C2065: “CollisionComponent”: ???
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.h(25): error C2143: ???: ??”;“(?””???)
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.h(25): error C4430: ??? - ??? int???: C++ ??? int
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.h(25): error C2238: ???“;”??
2>E:\WinterBattle\WinterBattle\Intermediate\Build\Win32\UE4\Inc\WinterBattle\WinterBattle.generated.cpp(63): error C2039: “CollisionComponent”: ??“AProjectile”???
2>E:\WinterBattle\WinterBattle\Source\WinterBattle\Projectile.h(10): note: ??“AProjectile”???
2>E:\WinterBattle\WinterBattle\Intermediate\Build\Win32\UE4\Inc\WinterBattle\WinterBattle.generated.cpp(63): error C2618: offsetof ???
2>ERROR : UBT error : Failed to produce item: E:\WinterBattle\WinterBattle\Binaries\Win32\WinterBattle.exe
2>Total build time: 2.48 seconds (Local executor: 0.00 seconds)
These are my coding
Projectile.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “CoreMinimal.h”
#include “GameFramework/Actor.h”
#include “Projectile.generated.h”
UCLASS()
class WINTERBATTLE_API AProjectile : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor’s properties
AProjectile();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(Category = Projectile, VisibleAnywhere, BlueprintReadOnly)
USphereComponent* CollisionComponent;
};
Projectile.cpp
#include “Projectile.h”
#include “Components/SphereComponent.h”
// Sets default values
AProjectile::AProjectile()
{
// 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;
CollisionComponent = CreateDefaultSubobject<USphereComponent>(TEXT("Collision"));
RootComponent = CollisionComponent;
}
// Called when the game starts or when spawned
void AProjectile::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AProjectile::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
I tried to add #include “Engine.h” but it gave me same outputs, my version is 4.16