天天看点

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