Log error

hi community , so i build my project in vs , and i got this error wich i have no idea what it can posibly mean

1>papCharacter.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl AWeapon::OnEquip(void)" (?OnEquip@AWeapon@@QEAAXXZ) referenced in function "public: void __cdecl ApapCharacter::EquiWeapon(class AWeapon *)" (?EquiWeapon@ApapCharacter@@QEAAXPEAVAWeapon@@@Z)
1>C:\Users\Rui\Documents\Unreal Projects\pap\Binaries\Win64\UE4Editor-pap.dll : fatal error LNK1120: 1 unresolved externals

Any ideas thank you

Hi,

Without seeing your code and setup, it’s hard to say. At a guess, I’d say either your module dependencies are set up wrongly, or your AWeapon class does not have a MODULENAME_API macro on it to export the symbols:

https://docs.unrealengine.com/latest/INT/Programming/Modules/API/index.html

Steve

ive searched a lot on google for the error error LNK2019 , but it seems to be an error for a lot of difrent stuff .

I rly cant find any solution here is the part of the code i think its refering from the log

void ApapCharacter::EquipWeapon(AWeapon *Weapon)
{
	if (CurrentWeapon != NULL)
	{
		CurrentWeapon = Inventory[CurrentWeapon->WeaponConfig.Priority];
		CurrentWeapon->OnUnEquip();
		CurrentWeapon = Weapon;
		Weapon->SetOwningPawn(this);
		Weapon->OnEquip();
	}
	else
	{
		CurrentWeapon = Weapon;
		CurrentWeapon = Inventory[CurrentWeapon->WeaponConfig.Priority];
		CurrentWeapon->SetOwningPawn(this);
		Weapon->OnEquip();
	}
}

Thank you for the reply so far

It’s the AWeapon class definition that needs investigating. I think you have something like:

UCLASS()
class AWeapon : public AActor

… but you need something like:

UCLASS()
class WEAPONMODULE_API AWeapon : public AActor

… but I can’t really help without posting your AWeapon class definition. The contents of your .cpp files are unlikely to be relevant to this problem.

Steve

There’s been no further response to this thread in a month, so I’m closing it for tracking purposes. Please open a new thread if you are still having problems.

Steve