# Overloaded member function not found - function does not take 1 arguements

**URL:** <https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677>\
**Category:** Pipeline & Plugins\
**Tags:** compiling, unreal-engine, Visual-Studio, UE4, question, CPP\
**Created:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677 "2014-03-11T02:39:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/1 "2014-03-11T02:39:23Z")

</div>

I’m getting the following build errors while trying to compile my code, despite it being identical to the ‘ShooterGame’ code. I can’t figure out exactly where the problem is occuring and the compiler isn’t pointing me to anywhere that can narrow it down.

The Error:

```
1>e:\thesommeue4\thesomme\intermediate\builddata\include\thesomme\../../../../Source/TheSomme/TheSommeWeapon.h(81): error C2061: syntax error : identifier 'ATheSommeCharacter'
1>E:\TheSommeUE4\TheSomme\Source\TheSomme\TheSommeCharacter.cpp(133): error C2660: 'ATheSommeWeapon::OnEnterInventory' : function does not take 1 arguments
1>E:\TheSommeUE4\TheSomme\Source\TheSomme\TheSommeWeapon.cpp(127): error C2511: 'void ATheSommeWeapon::OnEnterInventory(ATheSommeCharacter *)' : overloaded member function not found in 'ATheSommeWeapon'
1> e:\thesommeue4\thesomme\intermediate\builddata\include\thesomme\../../../../Source/TheSomme/TheSommeWeapon.h(55) : see declaration of 'ATheSommeWeapon'
1>E:\TheSommeUE4\TheSomme\Source\TheSomme\TheSommeWeapon.cpp(522): error C2660: 'ATheSommeWeapon::OnEnterInventory' : function does not take 1 arguments

```

The areas of interest:  
ATheSommeWeapon.cpp

```
void ATheSommeWeapon::OnEnterInventory(ATheSommeCharacter* NewOwner)
{
	SetOwningPawn(NewOwner);
}

void ATheSommeWeapon::OnRep_MyPawn()
{
	if (MyPawn)
	{
		OnEnterInventory(MyPawn);
	}
	else
	{
		OnLeaveInventory();
	}
}

```

TheSommeCharacter:

```
void ATheSommeCharacter::AddWeapon(ATheSommeWeapon* Weapon)
{
	if (Weapon && Role == ROLE_Authority)
	{
		Weapon->OnEnterInventory(this);
		Inventory.AddUnique(Weapon);
	}
}

```

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/2 "2014-03-11T02:39:24Z")

</div>

Hi James,

That error typically means that the function you are implementing in your .cpp file has a different signature than the function you declared in your class. For instance, if your declaration was

```
virtual void OnEnterInventory();

```

but your implementation was

```
void ATheSommeWeapon::OnEnterInventory(ATheSommeCharacter* NewOwner)

```

Hope that helps!

Jeff

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/3 "2014-03-11T02:39:25Z")

</div>

Hi Jeff, I checked that out but My Declaration is still the same in the header file, this is how it looks over there:

```
/** [server] weapon was added to pawn's inventory */
virtual void OnEnterInventory(ATheSommeCharacter* NewOwner);

```

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/4 "2014-03-11T02:39:25Z")

</div>

Looking at the error output again, the first error is “syntax error : identifier ‘ATheSommeCharacter’” in the TheSommeWeapon.h header file. Guessing you need a

```
#include "TheSommeCharacter.h"

```

or maybe

```
#include "TheSommeGameClasses.h"

```

in your .cpp file. Another good idea would be to use the class keyword on your declaration to avoid any ordering issues, like so

```
virtual void OnEnterInventory(class ATheSommeCharacter* NewOwner);

```

Jeff

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/5 "2014-03-11T02:39:26Z")

</div>

Thanks Jeff! Turns out adding the class keyword fixed the error…

Is there a particular reason my code requires that class keyword, whereas the shootergame example doesn’t?

---

<div class="post-metadata">

**Author:** ![ue4-archive](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ue4-archive](https://forums.unrealengine.com/u/ue4-archive)\
**Post date:** [March 11, 2014, 2:39am UTC](https://forums.unrealengine.com/t/overloaded-member-function-not-found-function-does-not-take-1-arguements/275677/6 "2014-03-11T02:39:26Z")

</div>

Glad to help!

I’m guessing it works in ShooterGame because the precompiled header (ShooterGame.h) includes the relevant headers.

Jeff
