Cannot clear this compile error about private member access!

So this is my first project using engine 4.6. I beleive i’ve satisfied all the changes from 4.5, but I cannot fix the error in the title. Here are my .h and .cpp files:

BoidPawn.h

#pragma once

#include "GameFramework/Pawn.h"
#include "BoidPawn.generated.h"

/**
 * 
 */
UCLASS()
class ZOMBIE_SHOOTER_API ABoidPawn : public APawn
{
	GENERATED_BODY()

public:

	/** Constructor */
	ABoidPawn(const class FObjectInitializer& ObjectInitializer);

	/** Separation volume */
	UPROPERTY(VisibleDefaultsOnly, Category = Movement)
	USphereComponent* SeparationSphere;

	/** Neighbour volume */
	UPROPERTY(VisibleDefaultsOnly, Category = Movement)
	USphereComponent* NeighbourSphere;

	/** Updates the pawn */
	void Update();

	/** Checks if the pawn is overlapping with any other boid_pawn */
	bool IsOverlapping();
	
};

BoidPawn.cpp

#include "Zombie_Shooter.h"
#include "BoidPawn.h"

ABoidPawn::ABoidPawn(const class FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	// create a separation volume used to detect collision
	SeparationSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("SeparationSphere"));
	SeparationSphere->AttachTo(RootComponent);
	SeparationSphere->SetSphereRadius(200.0f);

	// create a neighbour volume used to detect surrounding neighbours
	NeighbourSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("NeighbourSphere"));
	NeighbourSphere->AttachTo(RootComponent);
	NeighbourSphere->SetSphereRadius(600.0f);
}

/** Updates the pawn */
void ABoidPawn::Update()
{
}

/** Checks if the pawn is overlapping with any other boid_pawn */
bool ABoidPawn::IsOverlapping()
{
	return true;
}

Can anyone see what i’m doing wrong! I’m taring my hair out. My full error message is as follows:

error c2248: ‘ABoidPawn::ABoidPawn’ : cannot access private member delcared in class ‘ABoidPawn’

Many thanks in advance. :slight_smile:

Try “don’t” declare on the constructor on .h (it’s using the default Unreal constructor), since you don’t need a custom constructor, it will works. Keep the constructor Definition on cpp.

I still using the GENERATED_UCLASS_BODY() instead of the new GENERATED_BODY().

I guess this will made the code at least to compile.

I removed ‘class’ from the constructor to leave just “ABoidPawn(const FObjectInitializer& ObjectInitializer);” and it’s now working fine!