I have posted this one earlier before finding the solution. So I’m reposting as a question so peeps with the same error can find this solution for one of the causes for error C2084.
**Original Post:
I am having an Error when I compile a specific class.
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()
public:
private:
UPROPERTY(VisibleAnywhere, Category="Components")
class USpringArmComponent* SpringArm;
UPROPERTY(VisibleAnywhere, Category="Components")
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("SpringArm"));
SpringArm->SetupAttachment(RootComponent);
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(SpringArm);
}
This is the error list
I researched online, but no similar issues. What I’m doing wrong?
Thanks in advance!
** End of original post
Well, after a couple of minutes I found my fault.
In the public section in the .h file I forgot to declare ATank();
public:
ATank();
After entering the body in the public section, it compiled smoothly
Well Its solved!