我對Visual Studio並不陌生,我知道這方面有很多問題。但我真的不知道這一點。這是錯誤:Visual Studio 2015中無法解析的外部符號鏈接器錯誤
1>moc_displaycounter.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const Counter::staticMetaObject" ([email protected]@@[email protected]@B)
1>moc_displaymanometer.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ManoMeter::staticMetaObject" ([email protected]@@[email protected]@B)
1>moc_displaysvgmeter.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const SVGMeter::staticMetaObject" ([email protected]@@[email protected]@B)
所以我做了DUMPBIN /上導入庫出口,它返回此:
Microsoft (R) COFF/PE Dumper Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file analogwidgets.lib
File Type: LIBRARY
Exports
ordinal name
[email protected]@[email protected]@@@Z (public: __cdecl AbstractMeter::AbstractMeter(class QWidget *))
[email protected]@@[email protected]@B (public: static struct QMetaObject const Counter::staticMetaObject)
[email protected]@@[email protected]@B (public: static struct QMetaObject const Item::staticMetaObject)
[email protected]@@[email protected]@B (public: static struct QMetaObject const Led::staticMetaObject)
[email protected]@@[email protected]@B (public: static struct QMetaObject const ManoMeter::staticMetaObject)
[email protected]@@[email protected]@B (public: static struct QMetaObject const PotentioMeter::staticMetaObject)
[email protected]@@[email protected]@B (public: static struct QMetaObject const SVGMeter::staticMetaObject)
我檢查了導入庫的確切簽名。對於一個很好的方法,我使用取決於來檢查這些符號是否在DLL中(是的,我知道它在鏈接過程中不起作用,但只是爲了確保導入庫沒有被破壞),但仍然它不會鏈接。嘗試調試和發佈x64版本都沒有成功。以前沒有VS的其他版本的問題。
關於接下來我該做什麼的任何想法?
看起來你忘記了定義一些靜態類變量。 –
當您聲明某些內容但忘記定義它時會發生無法解析的外部符號錯誤。可能是成員函數或靜態變量。 –