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

Matthias Pospiech matthias.pospiech at gmx.de
Thu Dec 11 13:51:50 CET 2008


Arnold Krille schrieb:
> On Thursday 11 December 2008 12:59:11 Matthias Pospiech wrote:
>   
>> Matthias Pospiech schrieb:
>>     
>>> I have the following class which is derived from QwtPlot (which is
>>> derived from QFrame)
>>> It includes  Q_OBJECT, a moc file is created and part of the project,
>>> but I get this linker error:
>>> 1>moc_QScatterPlot.obj : error LNK2001: Nicht aufgelöstes externes
>>> Symbol ""public: static struct QMetaObject const
>>> QwtPlot::staticMetaObject"
>>> (?staticMetaObject at QwtPlot@@2UQMetaObject@@B)".
>>> Why, and how do I resolve it?
>>>       
>> It is resolved by removing Q_OBJECT
>> class QScatterPlot : public QwtPlot
>> {
>>     //Q_OBJECT
>>     
>
> Or by including the generated moc-file in your build. Either as a separate 
> source or by including <file>.moc in your <file>.cpp...
>
>   
"moc_QScatterPlot.cpp" IS part of the project and is compiled and linked.

I have not done anything different from all the other 50 Qt classes in 
the project but only get the error with this file.

Matthias



More information about the Qt-interest-old mailing list