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

**URL:** <https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, rpc, unreal-engine, CPP, question\
**Created:** [September 17, 2016, 4:18am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758 "2016-09-17T04:18:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0ba2eb3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0ba2eb3c](https://forums.unrealengine.com/u/anonymous_user_0ba2eb3c)\
**Post date:** [September 17, 2016, 4:18am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758/1 "2016-09-17T04:18:44Z")

</div>

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

Inventory.h

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

```

and they have this code:

Inventory.cpp

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

}

void UInventory::PickupItem_Implementation(APickup * itemOnGround)
{
	AddItemToInventory(itemOnGround->itemInfo);
	itemOnGround->Destroy();
}

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

```

but i keep getting these errors:

![107404-halp+plox.png]()

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 😛

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![S0rn0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@S0rn0](https://forums.unrealengine.com/u/S0rn0)\
**Post date:** [September 17, 2016, 5:14am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758/2 "2016-09-17T05:14:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0ba2eb3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0ba2eb3c](https://forums.unrealengine.com/u/anonymous_user_0ba2eb3c)\
**Post date:** [September 17, 2016, 5:18am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758/3 "2016-09-17T05:18:08Z")

</div>

Thank you so much, it worked!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0ba2eb3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0ba2eb3c](https://forums.unrealengine.com/u/anonymous_user_0ba2eb3c)\
**Post date:** [September 17, 2016, 5:19am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758/4 "2016-09-17T05:19:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![S0rn0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@S0rn0](https://forums.unrealengine.com/u/S0rn0)\
**Post date:** [September 17, 2016, 5:31am UTC](https://forums.unrealengine.com/t/lnk-2005-error-alredy-defined-in-cpp-obj-c-rpc/370758/5 "2016-09-17T05:31:15Z")

</div>

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).
