Hey there,
i’m getting compile Error C2084 “Function ATank::ATank(void) already has a body” after I added Tank subclass.
I’m using Unreal 5.1.1 and this is my code:
Tank.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "BasePawn.h"
#include "Tank.generated.h"
/**
*
*/
UCLASS()
class TOONTANKS_API ATank : public ABasePawn
{
GENERATED_BODY()
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category= "Toon Tanks", meta=(AllowPrivateAccess="true"))
class USpringArmComponent* SpringArm;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category= "Toon Tanks", meta=(AllowPrivateAccess="true"))
class UCameraComponent* Camera;
};
Tank.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Tank.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
ATank::ATank()
{
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring Arm"));
SpringArm->SetupAttachment(RootComponent);
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(SpringArm);
}
Thanks for your help!