UE4 boost lib連接錯(cuò)誤的解決方法
UE4工程的debug模式鏈接boost的時(shí)候出現(xiàn)錯(cuò)誤:
UE4 boost error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in
以下是UE4源碼的注釋?zhuān)馑际钦f(shuō)UE4編譯器在編譯debug版本的時(shí)候仍然會(huì)鏈接release版本的第三方庫(kù),因?yàn)閁E4的編譯器不支持在調(diào)試debug版本的第三方庫(kù)。
// 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;
內(nèi)容轉(zhuǎn)自:https://forums.unrealengine.com/showthread.php?63340-Building-engine-with-Debug-Runtime-library
解決辦法:
最簡(jiǎn)單的方法就是在構(gòu)建debug版本時(shí)候也去鏈接release版本的第三方庫(kù)。
網(wǎng)上另外一張方法:
在MyProject.Build.cs文件的構(gòu)造方法中添加配置:
- BuildConfiguration.bDebugBuildsActuallyUseDebugCRT = true;
這樣貌似鏈接boost是可以了,但是又出現(xiàn)其他鏈接錯(cuò)誤:
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)
查了一下,論壇上說(shuō)如果要使用CRT,需要使用源碼編譯的UE4,因?yàn)槟壳鞍姹緦?duì)VS2015支持還不完善,有時(shí)間了再?lài)L試下。
詳情見(jiàn):https://answers.unrealengine.com/questions/294191/vs2015-linker-errors.html
-
分享到:
您需要登錄后才可以發(fā)帖 登錄 | 立即注冊(cè)
- 用戶(hù)名:
- 密 碼:
- 驗(yàn)證碼: 看不清? 點(diǎn)擊更換
- 忘記密碼?
全部評(píng)論:0條