FWindowsPlatformSurvey gives linker error

Hello,

I’m trying to write some code to log out our playtester’s computer specs. I’m trying to use FWindowsPlatformSurvey::GetSurveyResults.

The lines I use to call it is:

FHardwareSurveyResults results;
FWindowsPlatformSurvey::GetSurveyResults(results, true);

I have included the header: “Windows/WindowsPlatformSurvey.h”

When I attempt to compile this in unreal, I get a linker error:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: static bool __cdecl FWindowsPlatformSurvey::GetSurveyResults(struct FHardwareSurveyResults &,bool)" (__imp_?GetSurveyResults@FWindowsPlatformSurvey@@SA_NAEAUFHardwareSurveyResults@@_N@Z) referenced in function...

But, if I run it through the editor (development solution configuration) my game will pop up fine, and run the survey. What am I missing here? I thought maybe I needed to surround it and the header with #IF PLATFORM_WINDOWS, but that didn’t seem to work either. I can’t figure out how to let it compile in the unreal editor. It’s ok if the function only works in standalone, but I need it to still at least compile in editor…

Add “ApplicationCore” to your Build.cs file.

Example:

PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"CoreUObject",
				"Engine",
				"InputCore",
				"ApplicationCore"
			}
);