Download

[ARKIT] Private headers preventing ARKit in C++

So I’m trying to use ARKit functionality in my 4.18 C++ project, and it turns out that none of it is exposed. Are we really only supposed to be using ARKit via the AppleARKitBlueprintLibrary?

I see all the other headers, but they are in the AppleARKit/Private directory. How am I supposed to use them?

I didn’t use this new feature yet; but I see it is a plugin so in whatever Module you want to add headers from it, in the module’s Build.cs file you have to include “AppleARKit” to dependency list first…
Then you can include any header from that ARKit module.

AppleARKit.Build.cs contains these declarations:

So, to include public headers after you add AppleARKit to your own Module’s dependency list:



#include "MyHeaderNameIwantToInclude.h"


To include headers that are inside a Private directory:



#include "Private/MyHeaderNameIwantToInclude.h"


This works until I try to use the FAppleARKitSystem. As soon as I call System->HitTestAtScreenPosition(), I get a linker error.


error LNK2019: unresolved external symbol "public: bool __cdecl FAppleARKitSystem::HitTestAtScreenPosition(struct FVector2D,enum EAppleARKitHitTestResultType,class TArray<struct FAppleARKitHitTestResult,class FDefaultAllocator> &)" (?HitTestAtScreenPosition@FAppleARKitSystem@@QEAA_NUFVector2D@@W4EAppleARKitHitTestResultType@@AEAV?$TArray@UFAppleARKitHitTestResult@@VFDefaultAllocator@@@@@Z) 

Any ideas on how to resolve this? I’ve already made to sure to include the AppleARKit, AugmentedReality, and HeadMountedDisplay modules in my Build.cs, but that hasn’t helped.

I think this is because many of the classes in the Private ARKit directory do not have the APPLEARKIT_API macro.

And since the UAppleARKitBlueprintLibrary’s functions are all private, you cannot use ARKit in C++.