LNK 2005 error "alredy defined in cpp.obj" C++ RPC

Remove ` void UInventory::PickupItem(APickup * itemOnGround)

}` in CPP

You do not need to provide this. Just validate and implementation are required.
Take note though, you still call this function when needed.

I’m trying to make a RPC with this function:


UFUNCTION(Server, Reliable, WithValidation)
	void PickupItem(APickup* itemOnGround);
	void PickupItem_Implementation(APickup* itemOnGround);
	bool PibkupItem_Validate(APickup* itemOnGround);

and they have this code:


void UInventory::PickupItem(APickup * itemOnGround)


void UInventory::PickupItem_Implementation(APickup * itemOnGround)

bool UInventory::PickupItem_Validate(APickup * itemOnGround)
	return true;

but i keep getting these errors:


My Build.cs:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore"});
        PrivateDependencyModuleNames.AddRange(new string[] { "Networking" });

And I also have the “Networking.h” include in Inventory.h

I also found this post [here][2] but I didn’t really understand it :stuck_out_tongue:

Thanks in advance!

Thank you so much, it worked!

Oh, one question, if I want to call the function on the server I should call PickupItem(APickup * itemOnGround) right?

Yes, the _Implementation and _Validate are called automatically. There is more to it than that, but for your question you just call PickupItem(APickup * itemOnGround).