I’m following the tutorial series about c++ programming as the title says and I’ve gotten to video three, followed all her steps, wrote the code exactly as she did and I get this:
1>C:/Users/Luna/Documents/Unreal Projects/TutorialCode_CPP/Source/TutorialCode_CPP/Public/PickUp.h(17): error : In PickUp: Member variable declaration: Missing variable type
1>Error : Failed to generate code for TutorialCode_CPPEditor - error code: 2
here is my pickup header and .cpp file.
pickup.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "PickUp.generated.h"
/**
*
*/
UCLASS()
class TUTORIALCODE_CPP_API APickUp : public AActor
{
GENERATED_UCLASS_BODY()
/*True when pick up is touched.*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PickUp);
bool bIsActive;
// set this to a UPROPERTY
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = PickUp);
TSubobjectPtr<USphereComponent> BaseCollisionComponent;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = PickUp);
TSubobjectPtr<UStaticMesh> PickupMesh;
/** Function to call when the pick up is collected.*/
UFUNCTION(BlueprintNativeEvent);
void onPickedUp();
};
pickup.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "TutorialCode_CPP.h"
#include "PickUp.h"
APickUp::APickUp(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
// The pickup is active when created.
bIsActive = true;
BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("Base Sphere Component"));
// set Sphere component as the root component,
RootComponent = BaseCollisionComponent;
// create static mesh.
PickupMesh = PCIP.CreateDefaultSubobject<UStaticMesh>(this, TEXT("Static Mesh"));
// turn physics on for the battery
PickupMesh->SetSimulatePhysics(true);
PickupMesh->AttachTo(RootComponent);
}
void APickUp::onPickedUp_Implementation()
{
// there is no function here, move along.
}
not sure what I’m doing wrong…