Updated to 4.20.3-release Error C4668 '_LARGEFILE64_SOURCE' is not defined

my project was building fine in 4.18.3 and visual studio 2015, without any code changes, I updated the engine to 4.20.3-release and using visual studio 2017 and now I cannot compile due to this error:

Error	C4668	'_LARGEFILE64_SOURCE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'	PSUnreal	f:\unrealengine\engine\source\thirdparty\zlib\zlib-1.2.5\inc\zconf.h	373	

Error	C4668	'_LFS64_LARGEFILE' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'	PSUnreal	F:\UnrealEngine\Engine\Source\ThirdParty\zlib\zlib-1.2.5\Inc\zlib.h	1574	

Please note UE builds ok, its my project which doesnt build anymore.

Seems related to zlib, but this component is part of the standard UE third party libs.

In my code I use zlib to compress and deflate some data. One of my source files has this include:

#include "ThirdParty/zlib/zlib-1.2.5/Inc/zlib.h"

Can’t find why this is happening. Any suggestions?

I fixed it by changing the way I import the zlib in my project, and switching from 1.2.5 to 1.2.8. Note above I was importing zlib 1.2.5.

I edited Build.cs to include this:

        if (Target.Platform == UnrealTargetPlatform.Win64)

            // zlib libraries
            PublicAdditionalLibraries.Add(Path.Combine(EngineDirectory, "Source", Target.UEThirdPartySourceDirectory, "zlib", "v1.2.8", "lib", "Win64", "VS2015", "zlib.lib"));

            // zLib includes
            PublicIncludePaths.Add(Path.Combine(EngineDirectory, "Source", Target.UEThirdPartySourceDirectory, "zlib", "v1.2.8", "include", "Win64", "VS2015"));


and then changed the include line in my source file to:

#include "zlib.h"

also if anybody else is struggling remeber to add using System.IO; to the build.cs and the lib name is actually zlibstatic.lib

For anyone trying to link zlib with UE5+ (windows 64), the correct path is now:

PublicAdditionalLibraries.Add(Path.Combine(EngineDirectory, "Source", Target.UEThirdPartySourceDirectory, "zlib", "v1.2.8", "lib", "Win64", "VS2015", "Release", "zlibstatic.lib"));