Can't link zlib(Boost) to the project

Hi everyone,

For my project, I need to link zlib from Boost library to my project.

I followed this tutorial Linking_Static_Libraries_Using_The_Build_System but I end up to get this error : LNK2019: unresolved external symbol.

I spent almost 2 days to resolve this problem by looking on the AnswerHub and on the Google but without success.
Here is the full Compilation log

The library Boost is in a folder Plugins at the root of the project.
My *.build.cs file looks like that :

using UnrealBuildTool;
using System.IO;

public class TestImport : ModuleRules
{
	private string ModulePath
	{
		get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
	}

	private string ThirdPartyPath
	{
		get { return Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); }
	}

	private string PluginsPath
	{
		get { return Path.GetFullPath(Path.Combine(ModulePath, "../../Plugins")); }
	}

	public TestImport(TargetInfo Target)
	{
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "ImageWrapper" });

		PrivateDependencyModuleNames.AddRange(new string[] { "RHI", "RenderCore", "ShaderCore" });

		LoadLibs(Target);
	}

	public bool	LoadLibs(TargetInfo 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(PluginsPath, "Boost", "lib", PlatformString);

			PublicLibraryPaths.Add(LibrariesPath);
			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libboost_iostreams-vc120-mt-1_57.lib"));
			PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "libboost_zlib-vc120-mt-gd-1_57.lib"));
		}

		if (isLibrarySupported)
		{
			PublicIncludePaths.Add(Path.Combine(PluginsPath, "Boost", "include"));
		}

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

		return isLibrarySupported;
	}
}

In a standalone C++ project, it works perfectly with Boost Library and zlib but the integration in UE is quite awfull

If someone has some tips for me, it would be great ! :slight_smile:

Thanks !

Problem resolved, I used the wrong .lib file.
Now it work perfectly with Boost Library.

I face the same question, so which is the right .lib file? Thanks a lot.