10-25-2024 12:42 PM - edited 10-25-2024 12:43 PM
In my project, I'd like to write some of the functionality in C++ vs. blueprints.
However, I'm unable to get past linker errors when calling functions from the Meta XR plugin. Specifically, I'm trying to create the custom Pawn, with the Oculus Controller Component.
I've added the following to the .Build.cs file:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput", "XRBase", "OculusXRInput", "OculusXRHMD" });
But adding this code (along with the relevant #include):
UOculusXRControllerComponent* MyController = CreateDefaultSubobject<UOculusXRControllerComponent>(TEXT("MotionControllerRight"));
Results in this compile error:
XRPawn.cpp.obj : error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UOculusXRControllerComponent::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UOculusXRControllerComponent@@CAPEAVUClass@@XZ) referenced in function "public: __cdecl AXRPawn::AXRPawn(void)" (??0AXRPawn@@QEAA@XZ)
C:\Users\XYZ\Documents\Unreal Projects\XR_Switch\Binaries\Win64\UnrealEditor-XR_Switch.patch_0.exe : fatal error LNK1120: 1 unresolved externals
10-28-2024 08:33 PM - edited 10-28-2024 08:34 PM
02-16-2025 10:38 AM
This is especially frustrating because the literal documentation for the literal API lists this as available: https://developers.meta.com/horizon/reference/unreal/v72/class_u_oculus_x_r_controller_component/
Meta, what the **bleep**?
02-17-2025 05:56 AM
This feels like an oversight, especially since it's in the public folder. There has been multiple times that Epic also forgot to put API macros in front of their class/method names their code. There is btw nothing stopping you from exposing more functions from the plugin to other modules as you have the source of the plugin.