Can't include custom library

I am trying to set up Kinect voice commands in a test Unreal project. After struggling with the unofficial Kinect plugin, I have decided to try another approach. I built a library in a separate Visual Studio project, and am currently exporting it to a static library (.lib).

I opened my Unreal project in MSVS by adding a new, blank class.

I followed this wiki tutorial up to the end of the “UE4 Build system” step, at which point the project builds successfully.

Here’s where the problems begin.

  1. The custom macro that my edited .build.cs file is supposed to add, WITH_KINECT_LISTENER_BINDING, is not defined according to Visual Studio’s Intellisense.
  2. I can’t include the header file for the library. I placed it in {Project directory}/ThirdParty/KinectListener/Includes, and trying to #include it causes a build error.

Am I supposed to do any configuration in Visual Studio to include the library, or should editing the .build.cs be enough?

Sorry to bump, but this is a blocking issue for me. I can’t get anywhere until I can get this library compiled in.

Update: It seems that adding my library project to the solution causes all of the Unreal “External Resources” to vanish, causing further problems like “couldn’t find Engine.h”. Rebuilding the project files from the .uproject fixes these problems, but gets me right back to square 1.

Update 2: I made a new version of the header for the main class in this library, which doesn’t refer to any other classes besides std::string. Including that made the project happy, until I tried to call the constructor/destructor of this class, defined in the stripped-down header. Now I get an unresolved external symbol error for both the constructor and the destructor.

Why isn’t my game project finding the function definitions in the static library? The constant WITH_KINECT_LISTENER_BINDING that my .build.cs file is supposed to add when the library loads is now defined as 1.

It turns out several problems contributed to this compilation failure. Here’s what I did to fix it:

  1. Change the static library to compile for x64 (required deleting and re-adding the x64 build target)
  2. Change the static library to compile for Release (required disabling SDL checks to suppress an error in a Windows SDK header)
  3. Import the Kinect SDK static libraries the same way I imported my own library

After doing all that, it compiles.

Digging old subject but found a missing step during procedure.

After following the official tutorial : A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

Try to “Generate Visual Studio Project File” from Windows Explorer :

UE4.17-MVS2015 Link Static Library.jpg

Solved my case.