<SOLVED> Error binding keys with InputComponent->BindKey

Hi. I am trying to bind keys in my player controller but i am getting an unresolved error:

void AMyPlayerController_CPP::SetupInputComponent()
{
	Super::SetupInputComponent();

	InputComponent->BindKey(EKeys::Left, IE_Pressed,this,&AMyPlayerController_CPP::setLEFTOn);
}

void AMyPlayerController_CPP::setLEFTOn()
{
	myLEFT = true;
}

The error i have is this:


  LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FInputChord::FInputChord(struct FKey,bool,bool,bool,bool)" (__imp_??0FInputChord@@QEAA@UFKey@@_N111@Z) referenced in function "public: virtual void __cdecl AMyPlayerController_CPP::SetupInputComponent(void)" (?SetupInputComponent@AMyPlayerController_CPP@@UEAAXXZ)
  LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FInputChord::FInputChord(struct FInputChord const &)" (__imp_??0FInputChord@@QEAA@AEBU0@@Z) referenced in function "public: struct FInputKeyBinding & __cdecl UInputComponent::BindKey<class AMyPlayerController_CPP>(struct FInputChord,enum EInputEvent,class AMyPlayerController_CPP *,void (__cdecl AMyPlayerController_CPP::*)(void))" (??$BindKey@VAMyPlayerController_CPP@@@UInputComponent@@QEAAAEAUFInputKeyBinding@@UFInputChord@@W4EInputEvent@@PEAVAMyPlayerController_CPP@@P84@EAAXXZ@Z)
  LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FInputChord::~FInputChord(void)" (__imp_??1FInputChord@@QEAA@XZ) referenced in function "public: struct FInputKeyBinding & __cdecl UInputComponent::BindKey<class AMyPlayerController_CPP>(struct FInputChord,enum EInputEvent,class AMyPlayerController_CPP *,void (__cdecl AMyPlayerController_CPP::*)(void))" (??$BindKey@VAMyPlayerController_CPP@@@UInputComponent@@QEAAAEAUFInputKeyBinding@@UFInputChord@@W4EInputEvent@@PEAVAMyPlayerController_CPP@@P84@EAAXXZ@Z)
  LNK2001: unresolved external symbol "public: __cdecl FInputChord::~FInputChord(void)" (??1FInputChord@@QEAA@XZ)
  LNK1120: 4 unresolved externals

any help?

I added this line in the build.cs file:

	PrivateDependencyModuleNames.AddRange(new string[] { "Slate" });
1 Like

How did you know that adding this to the build.cs file would fix the problem?

Thanks so much for posting the solution!