UE4 boost lib连接错误的解决方法
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
全部评论:0条