Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt 5.3.2 static build integrated with Qwt 6.1.1 - unresolved external symbols
Forum Update on Monday, May 27th 2025

Qt 5.3.2 static build integrated with Qwt 6.1.1 - unresolved external symbols

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    remedius
    wrote on last edited by
    #1

    Hello everyone,

    I've been trying for few days to run a static qwt application. What I've managed to do so far is:

    • compiled qt (5.3.2) as static libs from source, configured like follows:
      configure -static -debug-and-release -nomake examples -nomake tests -no-icu

    • compiled qwt (6.1.1) from source as static lib (used qmake.exe from above static qt 5.3.2 build)

    I'm using msvc-2012 compiler, I have compiled above libs with nmake.

    When i write a simple application, everything's just fine (the binary is 10MB or so). I developed an app using MinGW 4.8 compiler with shared libs, but when i try to compile it with static libs using my static environment with msvc-2012 (11.0) I get those errors:

    qwt.lib(qwt_symbol.obj):-1: error: LNK2019: unresolved external symbol "public: __thiscall QSvgRenderer::QSvgRenderer(class QObject *)" (??0QSvgRenderer@@QAE@PAVQObject@@@Z) referenced in function "public: void __thiscall QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument@QwtSymbol@@QAEXABVQByteArray@@@Z)

    qwt.lib(qwt_symbol.obj):-1: error: LNK2019: unresolved external symbol "public: bool __thiscall QSvgRenderer::isValid(void)const " (?isValid@QSvgRenderer@@QBE_NXZ) referenced in function "void __cdecl qwtDrawSvgSymbols(class QPainter *,class QPointF const *,int,class QSvgRenderer *,class QwtSymbol const &)" (qwtDrawSvgSymbols@@YAXPAVQPainter@@PBVQPointF@@HPAVQSvgRenderer@@ABVQwtSymbol@@@Z)

    qwt.lib(qwt_symbol.obj):-1: error: LNK2019: unresolved external symbol "public: class QRectF __thiscall QSvgRenderer::viewBoxF(void)const " (?viewBoxF@QSvgRenderer@@QBE?AVQRectF@@XZ) referenced in function "public: virtual class QRect __thiscall QwtSymbol::boundingRect(void)const " (?boundingRect@QwtSymbol@@UBE?AVQRect@@XZ)

    qwt.lib(qwt_symbol.obj):-1: error: LNK2019: unresolved external symbol "public: bool __thiscall QSvgRenderer::load(class QByteArray const &)" (?load@QSvgRenderer@@QAE_NABVQByteArray@@@Z) referenced in function "public: void __thiscall QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument@QwtSymbol@@QAEXABVQByteArray@@@Z)

    qwt.lib(qwt_symbol.obj):-1: error: LNK2019: unresolved external symbol "public: void __thiscall QSvgRenderer::render(class QPainter *,class QRectF const &)" (?render@QSvgRenderer@@QAEXPAVQPainter@@ABVQRectF@@@Z) referenced in function "public: void __thiscall QwtSymbol::drawSymbol(class QPainter *,class QRectF const &)const " (?drawSymbol@QwtSymbol@@QBEXPAVQPainter@@ABVQRectF@@@Z)

    I managed to find out that those errors pop up when I try to use object QwtPlotCurve.

    My .pro file:
    @
    CONFIG += static release

    INCLUDEPATH += C:/qwt-6.1.1/src
    LIBS += -LC:/qwt-6.1.1/lib -lqwt

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = QwtTest04
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    plot.cpp

    HEADERS += mainwindow.h
    plot.h
    @

    @
    plot.h file:

    #ifndef PLOT_H
    #define PLOT_H

    #include <qlayout.h>
    #include <qwt_plot.h>
    #include <qwt_plot_curve.h>
    #include <qwt_plot_grid.h>
    #include <qwt_symbol.h>
    #include <qwt_legend.h>
    #include <qwt_math.h>
    //#include <math.h>

    #include <qwt_plot_marker.h>
    #include <qwt_point_data.h>
    #include <qwt_plot_canvas.h>
    #include <qwt_plot_panner.h>
    #include <qwt_plot_magnifier.h>
    #include <qwt_text.h>

    class Plot : public QwtPlot {
    public:
    Plot(QWidget *parent = NULL);
    void setPlotAxis(double x, double y, double stepX, double stepY);
    void setPlotSamples(QVector<double>&x, QVector<double>&y);
    private:
    QwtPlotCurve *curve;
    signals:

    public slots:

    };

    #endif // PLOT_H
    @

    @
    plot.cpp file:

    #include "plot.h"

    Plot::Plot(QWidget *parent) :
    QwtPlot(parent)
    {
    QwtPlotGrid *grid = new QwtPlotGrid();
    curve = new QwtPlotCurve();
    grid->attach(this);

    curve->setTitle("SomeCurve");
    curve->setPen(Qt::blue, 2);
    
    this->setPlotAxis(10.0, 1.0, 1.0, 0.5);
    
    curve->attach(this);
    

    }

    void Plot::setPlotAxis(double x, double y, double stepX, double stepY){
    setAxisScale( yLeft, -y, y, stepY);
    setAxisScale( xBottom, 0, x, stepX);
    this->axisAutoScale(yLeft);
    setAxisScale( xBottom, 0.0, 400, 20 );
    }

    void Plot::setPlotSamples(QVector<double>&x, QVector<double>&y){
    curve->setSamples(x, y);
    this->axisAutoScale(yLeft);
    this->replot();
    }
    @

    When I comment the lines which invoke "curve" (lines: 9, 12, 13, 17 and 28 from plot.cpp), the whole thing compiles, so the rest seems to be working. Any idea what may be the issue?

    Greetings,
    Mike

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Welcome to devnet

      Did I understand correctly, that you have compiled Qt and Qwt using MSVC compiler?
      The application you are linking with the self-compiled Qt and Qwt libs are compiled with MinGW?

      You cannot mixed libs compiled with different compilers. You should use consistently the same compiler for libs and applications. There is only in few cases a compatibility between different compilers. For MSVC there is even between different versions no mixing possible.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        remedius
        wrote on last edited by
        #3

        Firstly I had problems with compiling Qt as static libs, so I developed my app using Qt with shared libs (installed from web) using MinGW compiler. After having my Qt environment compiled with MSVC 11.0 (static build) - Qwt 6.1.1 also compiled with MSVC 11.0 and qmake from static build - i created a copy of my app sources and compiled them with MSVC and qmake from the Qt static enviromnent (I have both in my Qt Creator and I am able to choose which to use when creating a project).

        As I wrote, when i comment the invocation of QwtPlotCurve() in my plot.cpp file (lines 9, 12, 13, 17 and 28), the program is able to build and run, just can't plot any curves. Could it be caused by the fact that the specific Qt 5.3.2 version doesn't work well with qwt 6.1.1 one when linked staticly?

        P.S. I checked that all the required libs are in my qtbase/lib and qwt-6.1.1/lib folders

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          [quote author="remedius" date="1424970327"]Firstly I had problems with compiling Qt as static libs, so I developed my app using Qt with shared libs (installed from web) using MinGW compiler. After having my Qt environment compiled with MSVC 11.0 (static build) - Qwt 6.1.1 also compiled with MSVC 11.0 and qmake from static build - i created a copy of my app sources and compiled them with MSVC and qmake from the Qt static enviromnent (I have both in my Qt Creator and I am able to choose which to use when creating a project).
          [/quote]
          OK, that should be possible.

          [quote author="remedius" date="1424970327"]
          As I wrote, when i comment the invocation of QwtPlotCurve() in my plot.cpp file (lines 9, 12, 13, 17 and 28), the program is able to build and run, just can't plot any curves. Could it be caused by the fact that the specific Qt 5.3.2 version doesn't work well with qwt 6.1.1 one when linked staticly?

          P.S. I checked that all the required libs are in my qtbase/lib and qwt-6.1.1/lib folders[/quote]
          I do not know. Have not stepped up to these versions yet. Furthermore, I am staying with MinGW and dlls.

          In the mean time Qwt 6.1.2 is available. You might want to check, if this helps.

          However, your error messages are looking to me that the correct library is not found. This might be a confusion of library path. As explained above the compilers are not compatible and all should be kept completely seperate. When using Qt creator you should not handle environment settings outside of Qt creator.

          Sometimes are a rerun of qmake and a rebuild helps.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved