Help with linking static 3rd party library/SDK (libZPlay)

Hello, I am trying to include a 3rd party library/SDK called libZPlay however, am having problems. I am using UE 4.8.0 and libZPlay is a 32-bit library.

The following is my current build file after following the guide:


// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public class Rhythm : ModuleRules{
    //for linking 3rd party libraries 
    private string ModulePath{
        get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
    }
    private string ThirdPartyPath{
        get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
    }
    //normal after this
	public Rhythm(TargetInfo Target){
        MinFilesUsingPrecompiledHeaderOverride = 1;//faster builds
        bFasterWithoutUnity = true;//faster builds
	PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore" });
        PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });//for UMG

        LoadlibZPlay(Target); //load libZPlay library
    }

    public bool LoadlibZPlay(TargetInfo Target){
        bool isLibrarySupported = false;

        if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32)){
            isLibrarySupported = true;

            string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86"; //prob not needed since only one version of the file
            string LibrariesPath = Path.Combine(ThirdPartyPath, "libZPlay", "Libraries");

            PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.lib"));
            //PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay_borland.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.a"));
            //PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libzplay.dll"));
            PublicDelayLoadDLLs.Add(Path.Combine(LibrariesPath, "libzplay.dll"));
        }

        if (isLibrarySupported){
            //include path
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "libZPlay", "Includes"));
        }

        Definitions.Add(string.Format("WITH_LIBZPLAY_BINDING={0}", isLibrarySupported ? 1 : 0));

        return isLibrarySupported;
    }
}


I have a ThirdParty folder in the root directory of the project, a libZPlay folder is in there that contains an Includes folder with my header files. Additionally, in the libZPlay folder there is a Libraries folder that contains my libZPlay.dll, libZPlay.lib, and libZPlay.a files. The header file is included in the following fashion: #include “…/…/…/ThirdParty/libZPlay/Includes/libzplay.h”. The visual studio files were also regenerated after all of this was added.

I try to run a function from said external library called ‘CreateZPlay()’ as shown below:


void UMusicAnalyzerWidget::initilizeMusicAnalyzer(){
	player = libZPlay::CreateZPlay();
	filePath = "D:/Christian/Music/Archive/Stick Me In My Heart (Radio Edit).mp3";
}

‘player’ is a ZPlay pointer created inside the UMusicAnalyzerWidget class, the function pretty much creates and initializes the object. However, when trying to build/compile i get the following errors:


Error	8	error LNK2019: unresolved external symbol __imp_CreateZPlay referenced in function "public: void __cdecl UMusicAnalyzerWidget::execinitilizeMusicAnalyzer(struct FFrame &,void * const)" (?execinitilizeMusicAnalyzer@UMusicAnalyzerWidget@@QEAAXAEAUFFrame@@QEAX@Z)	D:\GitHub\Rhythm\Rhythm\Intermediate\ProjectFiles\MusicAnalyzerWidget.cpp.obj	Rhythm
Error	9	error LNK1120: 1 unresolved externals	D:\GitHub\Rhythm\Rhythm\Binaries\Win64\UE4Editor-Rhythm.dll	1	1	Rhythm
Error	10	error : Failed to produce item: D:\GitHub\Rhythm\Rhythm\Binaries\Win64\UE4Editor-Rhythm.dll	D:\GitHub\Rhythm\Rhythm\Intermediate\ProjectFiles\ERROR	Rhythm
Error	11	error MSB3075: The command ""D:\Programs\Epic Games\4.8\Engine\Build\BatchFiles\Rebuild.bat" RhythmEditor Win64 Development "D:\GitHub\Rhythm\Rhythm\Rhythm.uproject" -rocket" exited with code 5. Please verify that you have sufficient rights to run this command.	C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets	43	5	Rhythm


After a bunch of looking around and stuff, I am stuck and not sure how to proceed. Any insight would be great!

Hey guys, I still haven’t been able to figure this out after more extensive searching. I am not sure if I am doing something incorrectly or if it has to do with UE 4.8

Hi Chris, sorry sometimes the forums is loss, i link some libreries but never libZPlay, check if the .lib is compatible with vs 2013 compiler and you have x64 or x86 version, i at ready just work x64, other ones was in the past for me.
This is the basic estructure:

folder structre.png

in your project folder create a ThirdParty folder, follows for a library folder, in my case is opencv and inside the typical folder for includes with your .headers and a lib folders with your .lib

now check my build.cs really is very stride forward



// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;
using System.IO;

public class ARTest : ModuleRules
{
	public ARTest(TargetInfo Target)
	{
        PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "RHI", "RenderCore", "ShaderCore", });

		PrivateDependencyModuleNames.AddRange(new string] {  });

        string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); //this return your project folder
        string ThirdParty = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); // now get the ThirdParty directory

        string LibraryPath = Path.Combine(ThirdParty, "opencv", "lib"); // my lib dir
        string IncludePath = Path.Combine(ThirdParty, "opencv", "include"); // my include dir

        //include the stuff, 
        PublicLibraryPaths.Add(LibraryPath); // add your library dir
        PublicIncludePaths.Add(IncludePath); // add your include dir
        PublicAdditionalLibraries.Add(LibraryPath + "/opencv_ts300.lib"); // link libraries
        PublicAdditionalLibraries.Add(LibraryPath + "/opencv_world300.lib");


		
	}
}




this is very step a step, if not compile, i afraid your .lib is not compatible with vs 2013 compiler

Cheers!

Hello, the library is compatible with the VS2013 compiler because I have used this library alone before without Unreal Engine. This library is only 32-bit though and I would need to figure out how to get it to work with Unreal Engine’s 64-bit project (I am guessing that is the problem). I have followed all those steps already as shown by the wiki tutorial.

ok sorry for my misunderstanding, anyway is the same!, as long i know, you cannot compile 32 bits in development editor mode, you need switch to shipping, and cooking your content before compile!, if you dont have x64 version i think you cannot debug your code in editor, because editor i just x64, UE just allows you compile 32 bits versions of your games.

let me know if you archive, others way let my try link libZPlay.

Cheers!