UE4 Tutorial - code transition issue

Hi, I’m new to the Unreal community and game dev. as a whole and I’ve found the tutorials on Unreal’s C++ Programming and I’ve watched some of them, but noticed that the version in the YouTube video(s) is an earlier version than 4.8 (the version I’m using). My issue is trying to address the error "no instance of constructor “APickup::APickup matches the argument list”. Not exactly sure what I’m doing wrong… but I’m pretty sure it has to do with version transitions involving C++ code. Here’s (most of) the header file:

`#pragma once

#include "GameFramework/Actor.h"
#include "Pickup.generated.h"

UCLASS()
class UNREALMINIPROJECT_API APickup : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	APickup(const FObjectInitializer& ObjectInitializer);

// rest of file..
}`

And the .cpp file w/ constructor def.:

#include "UnrealMiniProject.h"
#include "Pickup.h"


// Sets default values
APickup::APickup(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	// Pickup is valid upon creation
	bIsActive = true;

	BaseCollisionComponent = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));

	RootComponent = BaseCollisionComponent;

	PickupMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));

	PickupMesh->SetSimulatePhysics(true);

	PickupMesh->AttachTo(RootComponent);

}

Am I missing something or not implementing something right? Any and all help would be much appreciated!

I feel your pain man, I really do, holy s*** I do. I’m new to UE and I set out to make a post here about having similar issues with (4.8) and specifically this example code. In formatting my code for the post however, I managed to get the code to compile. So here ya go, this code compiled for me on UE 4.8.1! Good Luck! :smiley:

Pickup.h

#pragma once

#include "GameFramework/Actor.h"
#include "Pickup.generated.h"

UCLASS()
class UE4TEST_API APickup : public AActor
{
	GENERATED_BODY()
	
public:
	// Sets default values for this actor's properties
	APickup(const FObjectInitializer& ObjectInitializer);

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pickup")
		bool bIsActive;

	UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "Pickup")
		class USphereComponent* BaseCollisionComponent;

	UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "Pickup")
		class UStaticMeshComponent* PickupMesh;

	UFUNCTION(BlueprintNativeEvent)
		void OnPickedUp();
private:

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;
	
};

Pickup.cpp

#include "UE4TEST.h"
#include "Pickup.h"

// Sets default values
APickup::APickup(const FObjectInitializer &ObjectInitializer) :Super(ObjectInitializer)
{
	//Pickup is valid when created
	bIsActive = true;
	
	// create the root SphereComponent to handle the pup's collision
	BaseCollisionComponent = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));
	
	// Set the sphereComponent as root component
	RootComponent = BaseCollisionComponent;
	
	// Create the static mesh component
	PickupMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
	
	//Turn physics on for the static mesh
	PickupMesh->SetSimulatePhysics(true);
	
	//Attach StaticMeshComponent to the root component
	PickupMesh->AttachTo(RootComponent);
	
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

void APickup::OnPickedUp_Implementation()
{
	//There is no default behavior
}

// Called when the game starts or when spawned
void APickup::BeginPlay()
{
	Super::BeginPlay();
}

// Called every frame
void APickup::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
}