Why am I getting unresolved external Symbols when my Buildfile seems to include all the right dependencies?

I am trying to write a custom input device plugin. I am still trying to get the basic sample project to compile. Sadly the page about custom input devices and the custom input device plugin guide seem to be using slightly different example code, both outdated. I have gotten everything to build thus far, the only thing that keeps on failing is this line:

MessageHandler->OnControllerAnalog(FGamepadKeyNames::LeftTriggerAnalog, 0, 0.5f);

MessageHandler is a GenericApplicationMessageHandler and the OnControlerAnalog expects a FGamepadKeyNames::Type as the first argument. The example code passes EControllerButtons, but this seems to be outdated, as I can’t find any references to this and the code expects something different. Indeed FGamepadKeyNames also has a LeftTriggerAnalog etc., so I expect this to just be the successor interface.

Intellisense also has no problems with any of this, neither does the compiler itself. Instead, I get a LNK2001:

unresolved external symbol ""__declspec(dllimport) public: static class FName const FGamepadKeyNames::LeftTriggerAnalog" (__imp_?LeftTriggerAnalog@FGamepadKeyNames@@2VFName@@B)".

This seems to indicate to me that either InputCore is not correctly included as a dependency or that it does not export this symbol. I just can’t see why it would do that.

My build.cs clearly indicates it as a dependency:

PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",
				"InputCore",
				"InputDevice",
			}
			);
PrivateDependencyModuleNames.AddRange(
            new string[]
            {
                "Core",
                "CoreUObject",
                "Engine",
                "Slate",
		        "SlateCore",
                "InputCore",
                "InputDevice",
            }
            );

I made sure that I include all the right headerfiles, but this too doesn’t change a thing (core.h is included anyways via the PCH, so none of this is really necessary):

#include "IInputInterface.h"
#include "GenericApplicationMessageHandler.h"
#include "InputCoreTypes.h"

I just can’t figure out what I am missing. I have tried anything anybody has done who posted even vaguely similar problems. Am I using the wrong type? Is this thing somehow not exported in the engine code? Am I missing some dependency? I really don’t know what I am doing wrong here.

I’m just guessing, but maybe because you’re not including the full path to the header?

I don’t see how that makes much sense, considering this is a linker error to a dll. Unreal bakes modules into .dlls as far as I can tell, so this must mean it somehow doesn’t link against the required module/.dll or that the .dll doesn’t export the symbol. That’s what PublicDependencyModuleNames is for in the build.cs.

I tried and it changed nothing, as I expected. The header was found in the first place, or it wouldn’t even have gotten as far as the linker stage.

I found Unresolved external symbols in Slate - UI - Unreal Engine Forums and I’m not sure. You’ve done what Rama and Nick Darnell suggested.

Yeah, I know, I’ve tried out everything anybody already suggested that I could find. I am vexxed.

I’ve found that although reference tells us that the GamepadKeyNames structure is in Runtime/Core module, but in source code it was actually in Runtime/ApplicationCore. As usually the documentation is not updated.

So I guess you may try to add ApplicationCore as a dependency.

Thanks a lot, this is the solution to the mystery. I should really learn to trust the docs and reference less, this is far from the first time today alone that it is very outdated. Just goes to show how hard it is to see even an easy solution if your base premise is wrong :slight_smile: