Results 1 to 4 of 4

Thread: "Undefined reference to `QwtPlot::QwtPlot(QWidget*)'

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2021
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: "Undefined reference to `QwtPlot::QwtPlot(QWidget*)'

    Quote Originally Posted by Ginsengelf View Post
    Hi, this is a linker error. Do you link against the qwt library?

    Ginsengelf
    I used the following commands to link the Qwt with Qtcreator.

    Qt Code:
    1. ln -s /opt/qwt-6.1.0/plugins/designer/libqwt_designer_plugin.so /opt/Qt5.1.1/Tools/QtCreator/bin/plugins/designer/
    2. echo /opt/qwt-6.1.0/lib | tee /etc/ld.so.conf.d/qwt.conf
    3. ldconfig -v
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,348
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: "Undefined reference to `QwtPlot::QwtPlot(QWidget*)'

    ln -s /opt/qwt-6.1.0/plugins/designer/libqwt_designer_plugin.so /opt/Qt5.1.1/Tools/QtCreator/bin/plugins/designer/
    This command is linking against the Qwt plugin for Qt Designer, not the Qwt library itself.

    Your code also inherits privately from QwtPlot, which is not recommended. Your declaration for class plot should be:

    Qt Code:
    1. class plot : public QwtPlot
    2. {
    3. // ...
    4. };
    To copy to clipboard, switch view to plain text mode 

    I don't get any error for QwtPlotCurve (which shows that QWT is installed correctly).
    No, all you have done is declare a member variable that is a pointer to a QwtPlotCurve instance, which you don't actually instantiate (with "new") in the cpp file. So the compiler and linker are perfectly happy with that since nothing needs to be known about a pointer that is never used. It isn't proof of anything.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 2nd August 2019, 17:33
  2. Replies: 2
    Last Post: 13th March 2017, 07:59
  3. Replies: 10
    Last Post: 19th September 2012, 16:13
  4. Replies: 0
    Last Post: 15th July 2011, 04:21
  5. Replies: 6
    Last Post: 14th May 2009, 13:02

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
  •  
Qt is a trademark of The Qt Company.