C ++在虚幻引擎中包含库后的类型重定义

时间:2018-05-23 06:55:38

标签: c++ unreal-engine4 lib redefinition

我有以下问题。我下载了这个虚幻引擎第三方库(https://github.com/nialna/libnoise-UE4-ready)的git repo,它基本上是原始libnoise c ++库的ue4 64位端口。

我用所描述的所有步骤(安装了mfc类,用64位等构建它)构建它,并将.lib文件和包含文件复制到我的游戏项目中。 (如上所述) 一旦我在我的项目中包含lib,我就会遇到错误:

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'

好像这个corecrt.h文件多次被包含在内?另一个有趣的事情是有2个不同的Windows SDK版本输出错误。 (10.0.10240)和(10.0.17134.0)也可以解释文件被包含两次的原因。

我尝试从我的计算机上删除旧的sdk,但它甚至没有在visual studio安装程序中列出,它只是文件系统的jm。我从那里删除了它,但我仍然遇到这些错误。

我使用不同的sdk版本构建了lib ...没有变化...... 我已经花了好几个小时来处理这个问题,而且我现在也很无能为力。

1 个答案:

答案 0 :(得分:0)

我通过使用与库相同的编译器从我的机器上的源构建整个虚幻引擎来解决问题。