Download

StaticClass() gives unresolved external error. Why?

I have a line in my code:

Controllers* = GetWorld()->SpawnActor<ASixenseController>(ASixenseController::StaticClass(), GetActorLocation(), GetActorRotation(), SpawnInfo);

Which throws the error error " LNK2019: unresolved external symbol “private: static class UClass * __cdecl ASixenseController::GetPrivateStaticClass(wchar_t const *)” (?GetPrivateStaticClass@ASixenseController@@CAPEAVUClass@@PEB_W@Z) referenced in function “class ASixenseController * __cdecl CastChecked<class ASixenseController>(class UObject *,enum ECastCheckedType::Type)” (??$CastChecked@VASixenseController@@@@YAPEAVASixenseController@@PEAVUObject@@W4Type@ECastCheckedType@@@Z) "

My tests determine that it is specifically the StaticClass() that does this. So, my question is why? Is there a header I should include other than the SixenseController.h ? Is there a module I should add to the dependencies? I’m really racking my brain on this one as it is unlike previous unresolved external errors I have encountered, which were simply declaring something and forgetting to define it.

See if this helps: How can I resolve an Unresolved Externals error when referencing classes in another module? - UE4 AnswerHub

The module tag does not help.

UCLASS()
class SIXENSEPLUGIN_API ASixenseController : public AActor

I thought it was still giving the same error, but then I commented out the line from before and still had an unresolved external error. So, the minimal API tag thing (Unreal Documentation Page is down) is causing its own error. Testing that, I tried ENGINE_API which gave an error about not matching the dll the code is in. So SIXENSEPLUGIN_API is the correct tag, but gives an error. Additionally, the answer on that page linked gave a link to multiple modules, all my code is in one module.