when i make mothed tankAimingCoponent on the public
give me this error
unresolved external symbol “public: void __cdecl UTankAimingComponent::AimAt(struct FVector)” (?AimAt@UTankAimingComponent@@QEAAXUFVector@@@Z) referenced in function “public: void __cdecl ATank::AimAt(struct FVector)” (?AimAt@ATank@@QEAAXUFVector@@@Z)
my code:
Tank.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Tank.h"
// Sets default values
ATank::ATank()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// no need to protaect points as added construction
TankAimingComponent = CreateDefaultSubobject<UTankAimingComponent>(FName("Aiming Component"));
}
// Called when the game starts or when spawned
void ATank::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ATank::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
void ATank::AimAt(FVector HitLocation)
{
TankAimingComponent->AimAt(HitLocation);
}
TankAimingComponent.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "TankAimingComponent.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BATTLETANK_API UTankAimingComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
// Sets default values for this component's properties
UTankAimingComponent();
void AimAt(FVector HitLocation );
protected:
// Called when the game starts
virtual void BeginPlay() override;
private:
};
TankAminingComponenet.h
// Fill out your copyright notice in the Description page of Project Settings.
#include "TankAimingComponent.h"
#include <tuple>
// Sets default values for this component's properties
UTankAimingComponent::UTankAimingComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UTankAimingComponent::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UTankAimingComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}
void AimAt(FVector HitLocation)
{
UE_LOG(LogTemp,Warning,TEXT(" aim at %s"),*HitLocation.ToString());
}