I'm bumping this thread once again, since I'm still faced with the same problem. I'll try to be more specific. After my previous atempts I tried to build a static version of QWT (by disabling the "#QWT_CONFIG += QwtDll" option during installation) but I still can't build a static release of a QWT program
Take, for instance, this simple example. After a few slight modifications my *.pro file looks like this:
include( C:/qwt-6.0.1/qwt.prf )
QT += core gui
CONFIG += qt
TARGET = CppQwtExample1
TEMPLATE = app
SOURCES += main.cpp
static {
CONFIG += static
DEFINES += STATIC
}
include( C:/qwt-6.0.1/qwt.prf )
QT += core gui
CONFIG += qt
TARGET = CppQwtExample1
TEMPLATE = app
SOURCES += main.cpp
static {
CONFIG += static
DEFINES += STATIC
}
To copy to clipboard, switch view to plain text mode
and my main file looks like this:
#include <cmath>
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
int main(int argc, char **argv)
{
plot.setGeometry(0,0,640,400);
plot.
setAxisScale(QwtPlot::xBottom,
0.0,
2.0 * M_PI
);
plot.
setAxisScale(QwtPlot::yLeft,
-1.0,
1.0);
std::vector<double> xs;
std::vector<double> ys;
for (double x = 0; x < 2.0 * M_PI; x+=(M_PI / 10.0))
{
xs.push_back(x);
ys.push_back(std::sin(x));
}
sine.setSamples(&xs[0],&ys[0],xs.size());
sine.attach(&plot);
plot.show();
return a.exec();
}
#include <cmath>
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QwtPlot plot(QwtText("CppQwtExample1"));
plot.setGeometry(0,0,640,400);
plot.setAxisScale(QwtPlot::xBottom, 0.0,2.0 * M_PI);
plot.setAxisScale(QwtPlot::yLeft,-1.0,1.0);
QwtPlotCurve sine("Sine");
std::vector<double> xs;
std::vector<double> ys;
for (double x = 0; x < 2.0 * M_PI; x+=(M_PI / 10.0))
{
xs.push_back(x);
ys.push_back(std::sin(x));
}
sine.setSamples(&xs[0],&ys[0],xs.size());
sine.attach(&plot);
plot.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
I can build it just fine with the usual 4.7.0 release option. A static release, on the other hand, fails. I get a:
:: error: collect2: ld returned 1 exit status
:: error: collect2: ld returned 1 exit status
To copy to clipboard, switch view to plain text mode
linking error in build issues screen and lots of these kind of errors:
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x22b): undefined reference to `_imp___ZN4QPenC1EN2Qt8PenStyleE'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x245): undefined reference to `_imp___ZNK4QPeneqERKS_'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x261): undefined reference to `_imp___ZN6QBrushC1EN2Qt10BrushStyleE'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x27b): undefined reference to `_imp___ZNK6QBrusheqERKS_'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x28d): undefined reference to `_imp___ZN6QBrushD1Ev'
...
C:/Qwt-6.0.1/lib/libqwt.a(qwt_spline.o):qwt_spline.cpp:(.text$_ZN7QVectorIdEaSERKS0_[QVector<double>::operator=(QVector<double> const&)]+0x31): undefined reference to `_imp___ZN11QVectorData4freeEPS_i'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\CppQwtExample1.exe] Error 1
mingw32-make: *** [release] Error 2
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x22b): undefined reference to `_imp___ZN4QPenC1EN2Qt8PenStyleE'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x245): undefined reference to `_imp___ZNK4QPeneqERKS_'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x261): undefined reference to `_imp___ZN6QBrushC1EN2Qt10BrushStyleE'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x27b): undefined reference to `_imp___ZNK6QBrusheqERKS_'
C:/Qwt-6.0.1/lib/libqwt.a(qwt_text.o):qwt_text.cpp:(.text+0x28d): undefined reference to `_imp___ZN6QBrushD1Ev'
...
C:/Qwt-6.0.1/lib/libqwt.a(qwt_spline.o):qwt_spline.cpp:(.text$_ZN7QVectorIdEaSERKS0_[QVector<double>::operator=(QVector<double> const&)]+0x31): undefined reference to `_imp___ZN11QVectorData4freeEPS_i'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\CppQwtExample1.exe] Error 1
mingw32-make: *** [release] Error 2
To copy to clipboard, switch view to plain text mode
in the compile output. So my question remains - what might be the cause of this problem and what are the possible solutions to it?
Bookmarks