Download

RPC redefine error

I looked at examples of how to make an RPC, but when I try to make one of my own I am getting an error saying I redefined something, any idea what is wrong?

Pickup.gen.cpp.obj : error LNK2005: “protected: void __cdecl APickup::Server_OnTouch(void)” (?Server_OnTouch@APickup@@IEAAXXZ) already defined in Pickup.cpp.obj

// in pickup.h
	UFUNCTION(Server, Reliable, WithValidation)
	void Server_OnTouch();
	bool Server_OnTouch_Validate();
	void Server_OnTouch_Implementation();
// in pickup.cpp

void APickup::Server_OnTouch()
{
	UE_LOG(LogTemp, Warning, TEXT("FUNCTION CALLED"));
}

bool APickup::Server_OnTouch_Validate()
{
	UE_LOG(LogTemp, Warning, TEXT("VALIDATE CALLED"));
	return true;
}

void APickup::Server_OnTouch_Implementation()
{
	UE_LOG(LogTemp, Warning, TEXT("IMPLEMENTATION CALLED"));
}

Remove that and it should work, the code that’s being automatically generated already defines the function.