Hey! My c++ understanding is limited and I’m also new to Visual Studio and used to use CodeBlocks before, and now when I tried to follow the “Intro to programming tutorial” I got error C2039. This is how things looks:
Pizza.cpp:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "Code01.h"
#include "Pizza.h"
APizza::APizza(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
PrimaryActorTick.bCanEverTick = true;
TouchSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("TouchSphereComponent"));
TouchSphere->SetSphereRadius(20.f, false);
RootComponent->TouchSphere;
RotationRate = 180.f;
}
void APizza::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator MyRot = GetActorRotation();
MyRot.Roll += RotationRate * DeltaTime;
SetActorRotation(MyRot);
}
Pizza.h:
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameFramework/Actor.h"
#include "Pizza.generated.h"
/**
*
*/
UCLASS()
class APizza : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditDefaultsOnly, VisibleDefaultsOnly, Category = Powerup)
TSubobjectPtr<USphereComponent> TouchSphere;
UPROPERTY(EditDefaultsOnly, VisibleDefaultsOnly, Category = Powerup)
float RotationRate;
virtual void Tick (float DeltaTime) OVERRIDE;
};
Error: error C2039: ‘TouchSphere’ : is not a member of ‘USceneComponent’