UE4插件開發(fā)引用第三方庫問題總結(jié)

1.Windows平臺(tái)類型沖突

INT,UINT,DWORD ,FLOAT,TRUE ,FALSE 宏沖突

#include "Windows/AllowWindowsPlatformTypes.h"
你的頭文件
#include "Windows/HideWindowsPlatformTypes.h"

2.自增自減鎖沖突

InterlockedIncrement,InterlockedDecrement類一些列鎖沖突

#include "Windows/AllowWindowsPlatformAtomics.h"
你的頭文件
#include "Windows/HideWindowsPlatformAtomics.h"

3.第三方庫引起的警告

THIRD_PARTY_INCLUDES_START
你的頭文件
THIRD_PARTY_INCLUDES_END

以上部分可以合并在一起,寫成:


#if PLATFORM_WINDOWS
#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows/AllowWindowsPlatformAtomics.h"
THIRD_PARTY_INCLUDES_START
你的頭文件
THIRD_PARTY_INCLUDES_END
#include "Windows/HideWindowsPlatformAtomics.h"
#include "Windows/HideWindowsPlatformTypes.h"
#endif

4.宏重定義的問題

CONSTEXPR,check,dynamic_cast,PI四個(gè)宏會(huì)出現(xiàn)重定義的問題,在包含頭文件前使其無效化,然后恢復(fù)有效化就行了。

#if PLATFORM_WINDOWS
#pragma push_macro("CONSTEXPR")
#undef CONSTEXPR
#pragma push_macro("check")
#undef check
#pragma push_macro("dynamic_cast")
#undef dynamic_cast
#pragma push_macro("PI")
#undef PI
你的頭文件
#pragma pop_macro("PI")
#pragma pop_macro("check")
#pragma pop_macro("dynamic_cast")
#pragma pop_macro("CONSTEXPR")
#endif
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容