Results 1 to 4 of 4

Thread: Basic linking question with extending QwtPlotCanvas

  1. #1
    Join Date
    Dec 2009
    Location
    New Hampshire, USA
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Basic linking question with extending QwtPlotCanvas

    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Basic linking question with extending QwtPlotCanvas

    Quote Originally Posted by AwareWolf View Post
    I want to extend QwtPlotCanvas, ...
    No you don't want to do this,

    Uwe

  3. #3
    Join Date
    Dec 2009
    Location
    New Hampshire, USA
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Basic linking question with extending QwtPlotCanvas

    Quote Originally Posted by Uwe View Post
    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?

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Basic linking question with extending QwtPlotCanvas

    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

Similar Threads

  1. Basic question
    By giacomelli.fabio in forum Newbie
    Replies: 4
    Last Post: 18th December 2009, 01:12
  2. basic qthread question
    By zl2k in forum Qt Programming
    Replies: 2
    Last Post: 9th September 2008, 22:43
  3. Basic question on QComboBox
    By Raccoon29 in forum Newbie
    Replies: 2
    Last Post: 9th May 2008, 17:41
  4. Basic question on new and delete
    By jcr in forum General Programming
    Replies: 25
    Last Post: 14th February 2006, 16:09
  5. Using QSA: A very basic question
    By yogeshm02 in forum Newbie
    Replies: 3
    Last Post: 26th January 2006, 08:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.