Unresolved external symbol FSocketReference::InitialzeCompactBoneIndex

For some reason this code

const FBoneContainer RequiredBones;
FSocketReference ref;
ref.InitialzeCompactBoneIndex(RequiredBones);

compiles with the error

error LNK2019: unresolved external symbol "public: void __cdecl FSocketReference::InitialzeCompactBoneIndex(struct FBoneContainer const &)" (?InitialzeCompactBoneIndex@FSocketReference@@QEAAXAEBUFBoneContainer@@@Z) referenced in function "protected: virtual void __cdecl AFabrikFullBody::BeginPlay(void)" (?BeginPlay@AFabrikFullBody@@MEAAXXZ)
2>C:\Users\gamer\Documents\Unreal Projects\Fabrik\annapurnapics_rnd\Binaries\Win64\UE4Editor-FabrikConstraints-Win64-DebugGame.dll : fatal error LNK1120: 1 unresolved externals

Had this error before, so I modified dependencies in the build.cs file

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

PrivateDependencyModuleNames.AddRange(new string[] { "AnimGraphRuntime" });

and added #include "BoneControllers/AnimNode_SkeletalControlBase.h" in the .cpp file with the code. Don’t know why it doesn’t work, looks ok to me

Hi.

Funnily enough, I’ve had practically the same issue only today.

The problem seems to be that FSocketReference isn’t exposed within its dll and therefore cannot be accessed externally. To fix this I simply added the export macro (ANIMGRAPHRUNTIME_API) to the struct in the Engine source in AnimNode_SkeletalControlBase.h like this:

USTRUCT()
struct ANIMGRAPHRUNTIME_API FSocketReference
{
   ...

And by doing that my code could access the struct from within the AnimGraphRuntime dll. It does unfortunately require a change to the engine source code, but as it seems you’re running from source anyway, that might not be an issue for you.

Hope it helps.

Mike

Thanks, figured as much. Sadly I am not building the engine from the source code.

I am using simple yet ugly workaround: add FSocketReference method implementations from its .cpp file to .cpp files where they are used. Same with any other similar issue - just copy stuff and hope it won’t break in future versions.