[Qt-interest] unresolved Symbol (QMetaObject const QwtPlot::staticMetaObject) in qwtplot derived Class

Matthias Pospiech matthias.pospiech at gmx.de
Thu Dec 11 14:16:22 CET 2008


Ian Thomson schrieb:
> Hi,
>
> It seems as if you have a QObject derived class called Zoomer inside 
> your .cpp file. This class doesn't have the Q_OBJECT macro.
>
> Is this the case? If so, is moc being run on this class's definition 
> inside the .cpp file?
>
>   
Indeed not moc is generated for the Zoomer class. But this class is not 
using signals or slots itsself.
Out of interest I have placed it in the .h file. This now gives me 
errors for both classes:

1>moc_QScatterPlot.obj : error LNK2001: Nicht aufgelöstes externes 
Symbol ""public: static struct QMetaObject const 
QwtPlot::staticMetaObject" (?staticMetaObject at QwtPlot@@2UQMetaObject@@B)".
1>moc_QScatterPlot.obj : error LNK2001: Nicht aufgelöstes externes 
Symbol ""public: static struct QMetaObject const 
QwtPlotZoomer::staticMetaObject" 
(?staticMetaObject at QwtPlotZoomer@@2UQMetaObject@@B)".

So no problem is solved by adding a Q_OBJECT in the Zoomer class.

Matthias



More information about the Qt-interest-old mailing list