PDA

View Full Version : Basic linking question with extending QwtPlotCanvas



AwareWolf
26th January 2010, 14:52
I have been playing around with QwtPlots, seeing what I can do with them. I want to extend QwtPlotCanvas, which itself inherits from QFrame. When I build my application, I get a linker error:

1>moc_myplotcanvas.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlotCanvas::staticMetaObject" (?staticMetaObject@QwtPlotCanvas@@2UQMetaObject@@B )

If I add the moc_qwt_plot_canvas.cpp file built earlier into my project, it compiles and links just fine.

I suspect I am missing something obvious here.

Is there a built-in limitation here? Am I just not going to be able to extend a class that itself inherits from QObject, unless I include the moc file into my project?

Using Qt 4.6.0 and qwt 5.2.0.

Uwe
26th January 2010, 22:23
I want to extend QwtPlotCanvas, ...
No you don't want to do this,

Uwe

AwareWolf
27th January 2010, 12:50
No you don't want to do this,

Uwe

So I have discovered.:) But let's pretend that I DID want to. Am I just out of luck (can't be linked), or am I missing something?

Uwe
28th January 2010, 09:15
QwtPlotCanvas is like any other class derived from QObject - nothing special. The symptoms of your linker message sound like you did something wrong on your way building the corresponding moc file ( perhaps forgotten to call qmake manually to update your Makefile after adding the Q_OBJECT macro ).

Uwe