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條