I’m trying to build a plugin called ‘Kiface’ using The Kinect 2.0 C++ SDK. I’ve added a dependancy in my plugin’s build.cs file like so:
using UnrealBuildTool;
using System.IO;
public class kiface : ModuleRules
{
	public kiface(ReadOnlyTargetRules Target) : base(Target)
	{
        LoadKinectSDK(Target);
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		
		PublicIncludePaths.AddRange(
			new string[] {
				"kiface/Public",
				// ... add public include paths required here ...
			}
			);
        PrivateIncludePaths.AddRange(
			new string[] {
				"kiface/Private",
				// ... add other private include paths required here ...
			}
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				// ... add other public dependencies that you statically link with here ...
			}
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"Projects",
				"InputCore",
				"UnrealEd",
				"LevelEditor",
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",
				// ... add private dependencies that you statically link with here ...	
			}
			);
		
		
		DynamicallyLoadedModuleNames.AddRange(
			new string[]
			{
				// ... add any modules that your module loads dynamically here ...
			}
			);
	}
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
    }
    private string ModulePath
    {
        get { return ModuleDirectory; }
    }
    public bool LoadKinectSDK(ReadOnlyTargetRules Target)
    {
        bool isLibrarySupported = false;
        if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        {
            isLibrarySupported = true;
            string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
            string LibrariesPath = Path.Combine(ThirdPartyPath, "Kinect", "lib", PlatformString);
            PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "Kinect20.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "Kinect20.Face.lib"));
        }
        if (isLibrarySupported)
        {
            // Include path
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Kinect", "inc"));
        }
        Definitions.Add(string.Format("WITH_KINECT_SDK={0}", isLibrarySupported ? 1 : 0));
        return isLibrarySupported;
    }
}
In this file the important lines are:
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "Kinect20.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "Kinect20.Face.lib"));
And my project can build successfully, but when i try and open the project via the unreal editor, it tells me:
“Plugin ‘kiface’ failed to load because module ‘kiface’ could not be loaded. There may be an operating System error or the module may not be properly set up”
When i look at the log files i find this line:
Missing import: Kinect20.dll
and
Missing import: Kinect20.Face.dll
This makes sense why the project is crashing, because only Kinect20.lib and Kinect20.face.lib exist. But i specified them as .lib in the build.cs file, why is it trying to find .dll?