qt 5.5.1 和 visual studio 2010 未解析的外部符号

unresolved external symbol with qt 5.5.1 and visual studio 2010

问候语

我已通过 QT 4.8.5Visual Studio 2008 提交了申请。出于某种原因,我需要将 QT 更新为 5.5.1,将 Visual Studio 更新为 2010。我下载了 qt-everywhere-opensource-src-5.5.1 并构建了 Visual Studio 2010

configure -debug-and-release -opensource -platform win32-msvc2010 -icu -openssl -nomake examples -prefix C:\QT-Compile
nmake
nmake install

当我构建解决方案时,出现以下错误:

Error   1   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_ttu_manager.obj
Error   2   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_vdm_manager.obj
Error   3   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_wosa_event_listener.obj
Error   4   error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ) referenced in function "public: virtual struct QMetaObject const * __thiscall RPTRManager::metaObject(void)const " (?metaObject@RPTRManager@@UBEPBUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_rptr_manager.obj
Error   5   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_jptr_manager.obj
Error   6   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_sptr_manager.obj
Error   7   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_siu_manager.obj
Error   8   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_cim_manager.obj
Error   9   error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_dep_manager.obj
Error   10  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_idc_manager.obj
Error   11  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_pin_manager.obj
Error   12  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_device_manager.obj
Error   13  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_bcr_manager.obj
Error   14  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_cam_manager.obj
Error   15  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_cdm_manager.obj
Error   16  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_controller.obj
Error   17  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_user_interface.obj
Error   18  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_ssl_connection_manager.obj
Error   19  error LNK2001: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __thiscall QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QBEPAUQMetaObject@@XZ)  C:\Hashemi\Build\New_ATM\moc_fit_manager.obj
Error   20  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_vdm_manager.obj
Error   21  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_wosa_event_listener.obj
Error   22  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_jptr_manager.obj
Error   23  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_sptr_manager.obj
Error   24  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_siu_manager.obj
Error   25  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_ttu_manager.obj
Error   26  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_dep_manager.obj
Error   27  error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z) referenced in function __ehhandler$?startListenSignal@IDCManager@@QAEXVQString@@@Z C:\Hashemi\Build\New_ATM\moc_idc_manager.obj
Error   28  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_pin_manager.obj
Error   29  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_rptr_manager.obj
Error   30  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_bcr_manager.obj
Error   31  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_cam_manager.obj
Error   32  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_cdm_manager.obj
Error   33  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_cim_manager.obj
Error   34  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_controller.obj
Error   35  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_user_interface.obj
Error   36  error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall QObject::qt_metacast(char const *)" (__imp_?qt_metacast@QObject@@UAEPAXPBD@Z)    C:\Hashemi\Build\New_ATM\moc_fit_manager.obj

其实还有很多,我只是提一些而已。

我知道 unresolved external symbol 错误是关于链接器无法找到库,但是当我检查 Linker->General->Additional Library Directories 时,所有 lib 目录都已导入。

我在这里缺少什么!!!

提前致谢!!!

我发现了问题。

QT5 之前,我在 CMakeLists.txt.

中使用了以下几行
FIND_PACKAGE(Qt5 REQUIRED)  
...
TARGET_LINK_LIBRARIES(project-name
${QT_LIBRARIES}
...)

对于 QT5 我需要将它们更改为以下形式。

find_package(Qt5 REQUIRED COMPONENTS Core Gui Network Sql WebKit Widgets Multimedia) 
...
TARGET_LINK_LIBRARIES(project-name
    Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Sql Qt5::WebKit Qt5::Multimedia 
...)