天天看點

CloudCompare中inline函數重定義問題

CloudCompare中inline函數重定義問題

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: “public: static bool __cdecl ccLog::Print(class QString const &)” ([email protected]@@SA_NABVQString@@@Z) 已經在 ccPluginManager.obj 中定義

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: “public: static bool __cdecl ccLog::Warning(class QString const &)” ([email protected]@@SA_NABVQString@@@Z) 已經在 ccPluginManager.obj 中定義

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: "public: bool __thiscall ccObject::isKindOf(__int64)const " ([email protected]@@[email protected]) 已經在 ccviewertest.obj 中定義

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: "public: bool __thiscall ccObject::isA(__int64)const " ([email protected]@@[email protected]) 已經在 ccviewertest.obj 中定義

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: "public: unsigned int __thiscall ccHObject::getChildrenNumber(void)const " ([email protected]@@QBEIXZ) 已經在 ccviewertest.obj 中定義

QCC_DB_LIBd.lib(QCC_DB_LIBd.dll):-1 : error: LNK2005: "public: class ccHObject * __thiscall ccHObject::getChild(unsigned int)const " ([email protected]@@[email protected]@Z) 已經在 ccviewertest.obj 中定義

使用CloudCompare庫CC_CORE_LIB,QCC_DB_LIB,QCC_IO_LIB進行二次開發時,在Debug模式下由于/Ob0條件使得大量在頭檔案中的inline函數沒有被優化展開,連結時出現重定義錯誤(symbol redefined error),使用/Ob1依然無濟于事,經過多次調試,發現應在預處理器中加入以下三條定義:

CC_USE_AS_DLL

QCC_DB_USE_AS_DLL

QCC_IO_USE_AS_DLL