LNK2019 Error: unresolved external symbol in Unreal Engine

Hello,

I am a junior game developer and currently learning C++. I am working on a project in Unreal Engine and encountering an error that I cannot resolve. When I try to compile my code, I get the following error message:

File E:\Projects\TestCPP\Intermediate\Build\Win64\UnrealEditor\Development\TestCPP\Teleporter.cpp.obj was modified or is new Building patch from 1 file(s) for Live coding module E:\Projects\TestCPP\Binaries\Win64\UnrealEditor-TestCPP.dll Création de la bibliothèque E:\Projects\TestCPP\Binaries\Win64\UnrealEditor-TestCPP.patch_1.lib et de l'objet E:\Projects\TestCPP\Binaries\Win64\UnrealEditor-TestCPP.patch_1.exp Teleporter.cpp.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) private: static class UClass * __cdecl UMotionControllerComponent::GetPrivateStaticClass(void)" (_imp?GetPrivateStaticClass@UMotionControllerComponent@@CAPEAVUClass@@XZ) référencé dans la fonction "public: void __cdecl ATeleporter::OnOverlapBegin(class UPrimitiveComponent *,class AActor *,class UPrimitiveComponent *,int,bool,struct FHitResult const &)" (?OnOverlapBegin@ATeleporter@@QEAAXPEAVUPrimitiveComponent@@PEAVAActor@@0H_NAEBUFHitResult@@@Z) E:\Projects\TestCPP\Binaries\Win64\UnrealEditor-TestCPP.patch_1.exe : fatal error LNK1120: 1 externes non résolus Failed to link patch (0.000s) (Exit code: 0x460)

I have tried rebuilding the project several times, but the error persists. Can someone help me understand what this error means and how I can fix it?

void ATeleporter::OnOverlapBegin(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor,
	class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	UMotionControllerComponent* MotionController = Cast<UMotionControllerComponent>(OtherActor->GetComponentByClass(UMotionControllerComponent::StaticClass()));
	if (MotionController != nullptr)
	{
		// The MotionController triggered the collision event, perform the action here
		UE_LOG(LogTemp, Display, TEXT("helloWorld"));
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("helloWorld"));
	}
}

Thank you for your help!

I join the complete code.
Teleporter.cpp (2.5 KB)
Teleporter.h (890 Bytes)

Resolved :

In Source/[projectname]/[projectname].Build.cs

Edit follow line :

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

Like this :

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