How can I avoid a Slate linking error - FKey?

Hello

I receive these compiler errors when trying to add an SButton to my slate contruct

error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FKey::FKey(void)" (__imp_??0FKey@@QEAA@XZ) referenced in function "private: __cdecl FReply::FReply(void)" (??0FReply@@AEAA@XZ)

here the code that uses the SButton (If I comment the block out, everything works fine btw)

						+ SHorizontalBox::Slot()
						.HAlign(HAlign_Right)
						.AutoWidth()
						.Padding(15, 15, 40, 15)
						[
							SNew(SButton)
							.HAlign(HAlign_Center)
							.OnClicked(this, &SMyHelper::OnMyButtonPressed, false)
							.Text(LOCTEXT("MyHelper", "DoSomething"))
						]

my MyPlugin.Build.cs includes look like this

			PublicDependencyModuleNames.AddRange(
				new string[]
				{
					"Core",
					"CoreUObject",
                    "Engine",
                    "MainFrame",
                    "LevelEditor",
                    "EditorStyle",
                    "Slate",
					// ... add other public dependencies that you statically link with here ...
				}
				);

I did add the “Slate” to the private dependencies to see if something changes but it had no effect.

Any idea what needs to be included to avoid that link error ?

Slate needs some serious documentation imho… There is way not enough simple sample usage cases available today. :frowning:

You need a private module dependency to InputCore in your project’s Build.cs file.

hey thanks gmpreussner! That was a quick answer :slight_smile:

I solved this by adding
PrivateDependencyModuleNames.AddRange(new string[] { “Slate”, “SlateCore” });

to the build.cs file