我正在尝试链接到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
吗? 最佳答案
猜猜您的Qt版本没有SVG支持-否则您忘记将其添加到项目依赖项中。如果您对SVG内容完全不感兴趣,也可以在qwtconfig.pri中将其禁用:
参见:“ QWT_CONFIG + = QwtSvg”
关于c++ - Unresolved external 链接到静态Qwt构建,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32892437/