I am using Qwt 6.1.0 compiled with MSVC 2010 with the following commands:
qmake qwt.pro "QWT_CONFIG+=QwtExamples QwtPlayground"
jom -j 3
del /s *.obj
All is fine - I can use from my app any Qwt class. But when I derive from a Qwt class that in second order is QObject descendant, I have linking error. Example:
SignalPlotWidget.h - file from my app:
#include <qwt_plot.h>
class Plot : public QwtPlot
{
Q_OBJECT
typedef QwtPlot Base;
public:
explicit Plot(QWidget* parent = 0) : Base(parent) {}
explicit Plot(const QwtText& title, QWidget* parent = 0) : Base(title, parent) {}
virtual ~Plot() {}
};
The error:
moc_SignalPlotWidget.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMetaObject" (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
Both the Qwt and the app are compiled with MSVC 2010. Both static and dynamic Qwt linking to the app were tried.
There is no such problem with MinGW 4.8.
The error looks as there is no Qt meta object info in compiled Qwt. How is it formed?
Thanks
I said with an error: I tried only dynamic version of Qwt (there is my lib in the app with switch static/dynamic).
The problem lies in QWT_EXPORT macro. An app if it uses dynamic Qwt, must specify QWT_DLL macro to turn in QWT_EXPORT proper expansion (to __declspec(dllimport)).
The problem is solved now.
Bookmarks