我试图链接到Qwt的静态版本。为了创建静态构建,我修改了qwtconfig.pri
以包含
#QWT_CONFIG += QwtDll
我删除了代码中的所有#define QWT_DLL
引用。
然而,当我链接到库时,我得到一堆抱怨QSvgRenderer的未定义引用:
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSvgRenderer::QSvgRenderer(class QObject *)" (__imp_??0QSvgRenderer@@QEAA@PEAVQObject@@@Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument@QwtSymbol@@QEAAXAEBVQByteArray@@@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSvgRenderer::~QSvgRenderer(void)" (__imp_??1QSvgRenderer@@UEAA@XZ) referenced in function "public: virtual void * __cdecl QSvgRenderer::`scalar deleting destructor'(unsigned int)" (??_GQSvgRenderer@@UEAAPEAXI@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::isValid(void)const " (__imp_?isValid@QSvgRenderer@@QEBA_NXZ) referenced in function "void __cdecl qwtDrawSvgSymbols(class QPainter *,class QPointF const *,int,class QSvgRenderer *,class QwtSymbol const &)" (?qwtDrawSvgSymbols@@YAXPEAVQPainter@@PEBVQPointF@@HPEAVQSvgRenderer@@AEBVQwtSymbol@@@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QRectF __cdecl QSvgRenderer::viewBoxF(void)const " (__imp_?viewBoxF@QSvgRenderer@@QEBA?AVQRectF@@XZ) referenced in function "public: virtual class QRect __cdecl QwtSymbol::boundingRect(void)const " (?boundingRect@QwtSymbol@@UEBA?AVQRect@@XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::load(class QByteArray const &)" (__imp_?load@QSvgRenderer@@QEAA_NAEBVQByteArray@@@Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument@QwtSymbol@@QEAAXAEBVQByteArray@@@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSvgRenderer::render(class QPainter *,class QRectF const &)" (__imp_?render@QSvgRenderer@@QEAAXPEAVQPainter@@AEBVQRectF@@@Z) referenced in function "public: void __cdecl QwtSymbol::drawSymbol(class QPainter *,class QRectF const &)const " (?drawSymbol@QwtSymbol@@QEBAXPEAVQPainter@@AEBVQRectF@@@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QSvgRenderer::metaObject(void)const " (?metaObject@QSvgRenderer@@UEBAPEBUQMetaObject@@XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual int __cdecl QSvgRenderer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QSvgRenderer@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual void * __cdecl QSvgRenderer::qt_metacast(char const *)" (?qt_metacast@QSvgRenderer@@UEAAPEAXPEBD@Z)
15>C:\workspace\fixQwt\executables\linkerGUI\bin\Release\linkerGUI.exe : fatal error LNK1120: 9 unresolved externals
我需要在项目配置中做些什么,以便能够正确链接到QSvgRenderer
吗?
答案 0 :(得分:1)
猜猜您的Qt版本没有SVG支持 - 或者您忘记将其添加到项目依赖项中。如果你对SVG的东西不感兴趣,你也可以在qwtconfig.pri中禁用它:
请参阅:“QWT_CONFIG + = QwtSvg”