Overloaded member function not found

I just can’t get it to compile looked through the git and my code matches.
Hope somebody can help.

UE4 error code:

Total build time: 4.56 seconds (Parallel executor: 0.00 seconds)
Using 'git status' to determine working set for adaptive non-unity build (E:\3D\UE4\Escape).
Compiling game modules for hot reload
Building 3 actions with 8 processes...
  [1/3] OpenDoor.cpp
   E:\3D\UE4\Escape\BuildingEscape\Source\BuildingEscape\OpenDoor.cpp(9) : error C2511: 'UOpenDoor::UOpenDoor(void)': overloaded member function not found in 'UOpenDoor'
  E:\3D\UE4\Escape\BuildingEscape\Source\BuildingEscape\OpenDoor.h(16): note: see declaration of 'UOpenDoor'
ERROR: UBT ERROR: Failed to produce item: E:\3D\UE4\Escape\BuildingEscape\Binaries\Win64\UE4Editor-BuildingEscape-7941.dll
       (see ../Programs/UnrealBuildTool/Log.txt for full exception trace)

.CPP file:

#include "OpenDoor.h"
#define OUT


// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
{
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;

	// ...
}


// Called when the game starts
void UOpenDoor::BeginPlay()
{
	Super::BeginPlay();
	Owner = GetOwner();
	if (!PressurePlate)
	{
		UE_LOG(LogTemp, Error, TEXT("%s missing pressure plate"), *GetOwner()->GetName());
	}
}

// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

	// Poll the Trigger Volume
	if (GetTotalMassOfActorsOnPlate() > TriggerMass)
	{
		OnOpen.Broadcast();
	}
	else	
	{
		OnClose.Broadcast();
	}
}

float UOpenDoor::GetTotalMassOfActorsOnPlate()
{
	float TotalMass = 0.f;

	// Find all overlapping actors
	TArray<AActor*> OverlappingActors;
	if(!PressurePlate) {return TotalMass;}
	PressurePlate->GetOverlappingActors(OUT OverlappingActors);
	
	// Iterate trough them adding their masses
	for (const auto* Actor : OverlappingActors)
	{
		TotalMass += Actor->FindComponentByClass<UPrimitiveComponent>()->GetMass();
	}	
	return TotalMass;
}

.h file:

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "DrawDebugHelpers.h"
#include "Runtime/Engine/Public/CollisionQueryParams.h"
#include "Runtime/Engine/Classes/PhysicsEngine/PhysicsHandleComponent.h"
#include "Runtime/Engine/Classes/Components/InputComponent.h"
#include "Grabber.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UGrabber : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	UGrabber();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

private:		
	//Grabber reach distance
	UPROPERTY(EditAnywhere)
	float Reach = 200.f;

	UPhysicsHandleComponent* PhysicsHandle = nullptr;
	
	UInputComponent*  InputComponent = nullptr;		

	//Player get reach line end
	FVector GetReachLineEnd();
	FVector GetReachLineStart();
	
	//Ray-cast and grab what is in reach
	void Grab();

	//Call when grab is released
	void Release();

	// Find attached physics handle
	void FindPhysicsHandleComponent();

	// Find input component GRAB
	void FindInputComponentGrab();

	// Return hit for physics body in reach
	const FHitResult GetFirstBodyInReach();
};

It looks like you pasted in the wrong header file. That’s the header for Grabber not OpenDoor.

You need to paste in the OpenDoor.h file contents. If that is the contents then that would definitely be a reason why it wouldn’t build.

This is the problem though:

error C2511: 'UOpenDoor::UOpenDoor(void)': overloaded member function not found in 'UOpenDoor

Oh sorry here is the header file

// Copyright Munkhead 2019

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Engine/TriggerVolume.h"
#include "Runtime/Engine/Classes/GameFramework/Actor.h"
#include "Runtime/Engine/Classes/Components/ActorComponent.h"
#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
#include "OpenDoor.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE(FDoorEvent);

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UOpenDoor : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	UPROPERTY(BlueprintAssignable)
	FDoorEvent OnOpen;
	
	UPROPERTY(BlueprintAssignable)
	FDoorEvent OnClose;

private:
	// Artist controled trigger volume selector
	UPROPERTY(EditAnywhere) 
	ATriggerVolume* PressurePlate; 

	// Trigger mass for unlock
	UPROPERTY(EditAnywhere)
	float TriggerMass = 90.f;

	// Returns total Mass on Plate in KG
	float GetTotalMassOfActorsOnPlate();	

	float TotalMass();

	AActor* Owner = nullptr; // The owning door
};

Oh, I figured it out I forgot to set UOpenDoor(); in the header file. Thank you for your help.

Privacy & Terms