[UE4]boost lib连接错误:LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL'

文章详细介绍了在使用Unreal Engine 4(UE4)开发过程中遇到debug模式链接boost库出现错误时的解决方案。通过在构建配置中调整参数,可以使得debug版本的UE4工程正确链接release版本的第三方库。同时讨论了使用不同版本运行时库的利弊,并提供了解决链接错误的具体步骤。

 

UE4工程的debug模式链接boost的时候出现错误:

UE4  boost error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in 

 

以下是UE4源码的注释,意思是说UE4编译器在编译debug版本的时候仍然会链接release版本的第三方库,因为UE4的编译器不支持在调试debug版本的第三方库。

 

// By default we use the Release C++ Runtime (CRT), even when compiling Debug builds.  This is because the Debug C++

// Runtime isn't very useful when debugging Unreal Engine projects, and linking against the Debug CRT libraries forces

// our third party library dependencies to also be compiled using the Debug CRT (and often perform more slowly.)  Often

// it can be inconvenient to require a separate copy of the debug versions of third party static libraries simply

// so that you can debug your program's code.

bDebugBuildsActuallyUseDebugCRT = false;

内容转自:https://forums.unrealengine.com/showthread.php?63340-Building-engine-with-Debug-Runtime-library

 

解决办法:

最简单的方法就是在构建debug版本时候也去链接release版本的第三方库

 

网上另外一张方法:

MyProject.Build.cs文件的构造方法中添加配置:

BuildConfiguration.bDebugBuildsActuallyUseDebugCRT = true;

 这样貌似链接boost是可以了,但是又出现其他链接错误:

 error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (__imp_?_Debug_message@std@@YAXPEB_W0I@Z) referenced in function "int __cdecl std::_Atomic_compare_exchange_strong_4(unsigned long volatile *,unsigned long *,unsigned long,enum std::memory_order,enum std::memory_order)" (?_Atomic_compare_exchange_strong_4@std@@YAHPECKPEAKKW4memory_order@1@2@Z)

 

查了一下,论坛上说如果要使用CRT,需要使用源码编译的UE4,因为目前版本对VS2015支持还不完善,有时间了再尝试下。

详情见:https://answers.unrealengine.com/questions/294191/vs2015-linker-errors.html

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值