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
↧