Type redefinition after including third party library. (libnoise)

I have the folliwing problem. I downloaded the git repo of this unreal engine third party library ( GitHub - nialna/libnoise-UE4-ready: Version of libnoise updated for use with VS2017 and pre-configured to be compatible with Unreal Engine 4 ) which is basically a ue4 64 bit port of the original libnoise c++ library.

I built it with all the steps described (installed mfc classes, built it in 64 bit etc…) and copied the .lib files and the include files to my game project. (As described) As soon as i include the lib in my project i get the following errors:

1>C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\corecrt.h(134): error C2953: ‘_CrtEnableIf<true,_Ty>’: class template has already been defined 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(125): note: see declaration of ‘_CrtEnableIf<true,_Ty>’ 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\corecrt.h(489): error C2011: ‘__crt_locale_data_public’: ‘struct’ type redefinition 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(455): note: see declaration of ‘__crt_locale_data_public’ 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\corecrt.h(496): error C2011: ‘__crt_locale_pointers’: ‘struct’ type redefinition 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(462): note: see declaration of ‘__crt_locale_pointers’ 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt\corecrt.h(504): error C2011: ‘_Mbstatet’: ‘struct’ type redefinition 1>C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt\corecrt.h(470): note: see declaration of ‘_Mbstatet’

It seems like this corecrt.h file gets included multiple times? And the other funny thing is there are 2 different windows SDK versions outputting the errors. (10.0.10240) and (10.0.17134.0) which could also explain why the files gets included twice.

I tried to delete the older sdk from my machine but it’s even not listed in the visual studio installer, it’s only jm the file system. I deleted it from there but i still got these errors.

I built the lib with different sdk versions… No change… I already spent hours on this problem and i’m clueless right now.

i solved the problem with building the whole engine from source on my machine with the same compiler as the library.

Hi dave,

Can you describe what did you do to solve the problem? I’m not using libnoise, but get the same compile error. Thanks.

I solved the problem by renaming directory 10.0.10240.0 and rebuilding the project.