Adding ThirdPersonCharacter CPP in a blueprint create an error

Hi, I am new to Unreal Engine, and I am using UE 4.26 Currently.

I was following a tutorial on Youtube ( UE4 C++/Blueprint AI Basics Part 3: Patrol/Chase Bot - YouTube

I originally created my project in blueprint type and turns out the tutorial needed me to use C++ type of project.

My problem came after the tutorial needed me to access the Character.h. I have no access to the C++ code as I started the project in Blueprint type. So I created a ThirdPersonCharacter cpp from the templates that are available on the editor.

I managed to include Character.h in my codes, but when I tried to compile the code, the message logs shows an error

CompilerResultsLog: Error: TP_ThirdPersonCharacter.cpp.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: static void __cdecl UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition(float,enum EOrientPositionSelector::Type)” (_imp?ResetOrientationAndPosition@UHeadMountedDisplayFunctionLibrary@@SAXMW4Type@EOrientPositio
nSelector@@@Z) referenced in function “protected: void __cdecl ATP_ThirdPersonCharacter::OnResetVR(void)” (?OnResetVR@ATP_ThirdPersonCharacter@@IEAAXXZ)
CompilerResultsLog: Error: C:\Users\User\Documents\Unreal Projects\MyProject\Binaries\Win64\UE4Editor-MyProject-0172.dll : fatal error LNK1120: 1 unresolved externals

Is there any solution or alternative to this matter?

The C++ template by default is set up to use the VR module. Either delete the lines referencing HeadMountedDisplay in the CPP file (they’re not needed if you aren’t supporting VR), or add “HeadMountedDisplay” to the list of private dependencies in the .Build.cs file. Either should be enough to get you back up and running.

I did what you did told me to and my program worked without any problem. Thank you very much with the help

1 Like