Results 1 to 8 of 8

Thread: Unable to create qwtPlot object

  1. #1
    Join Date
    Jan 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Unable to create qwtPlot object

    I am currently trying to create a scatter plot but, I'm unsure of what the problem is. I found this code online and I was using it as a starting point but, I can't get the program to build. This is the code that I am using.

    Qt Code:
    1. #include <cmath>
    2. #include <QApplication>
    3. #include <qwt-qt4/qwt_plot.h>
    4.  
    5. int main(int argc, char **argv)
    6. {
    7. QApplication a(argc, argv);
    8.  
    9. QwtPlot plot;
    10. plot.setGeometry(0,0,640,400);
    11. plot.setAxisScale(QwtPlot::xBottom, 0.0,2.0 * M_PI);
    12. plot.setAxisScale(QwtPlot::yLeft,-1.0,1.0);
    13.  
    14. QwtPlotCurve sine("Sine");
    15. std::vector<double> xs;
    16. std::vector<double> ys;
    17. for (double x = 0; x < 2.0 * M_PI; x+=(M_PI / 10.0))
    18. {
    19. xs.push_back(x);
    20. ys.push_back(std::sin(x));
    21. }
    22. sine.setData(&xs[0],&ys[0],xs.size());
    23. sine.attach(&plot);
    24.  
    25. plot.showFullScreen();
    26. return a.exec();
    27. }
    To copy to clipboard, switch view to plain text mode 

    The errors that I get don't really tell me anything. The errors tells me the file path of these things and says undefined reference to:
    QwtPlot::QwtPlot(QWidget*)
    QwtPlot::setAxisScale(...)
    QwtPlot::setAxisScale(...)
    QwtPlot::~QwtPlot()
    QwtPlot::~QwtPlot()

    just to name a few. Does anyone know a possible solution to this problem.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Unable to create qwtPlot object

    Link against Qwt...

    QT += qwt
    if you've used make install when compiling qwt or
    LIBS += -L/path_to_qwt/lib -lqwt
    if you haven't.

  3. #3
    Join Date
    Jan 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Unable to create qwtPlot object

    I'm not sure what that means. I am running Ubuntu on my computer and i think i installed qwt when i used the code on their homepage to download the files. I can type #include <> and it will show qwt_qt4. I don't know if that helps any.

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

    Default Re: Unable to create qwtPlot object

    Quote Originally Posted by jtso8 View Post
    I can type #include <> and it will show qwt_qt4. I don't know if that helps any.
    What version of Qwt is it and - if it is a Qwt 6 - does the Ubuntu Package install the qwt.prf file ?

    Uwe

  5. #5
    Join Date
    Jan 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Unable to create qwtPlot object

    To install qwt I went to the homepage and used this:
    svn co https://qwt.svn.sourceforge.net/svnr...anches/qwt-6.0
    To install qwt and I'm unsure Id qwt.prf was installed as well but I will look for that later tonight. I know a file was created by qwt in my home directory.

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

    Default Re: Unable to create qwtPlot object

    So you have built and compiled your own version of Qwt - not using the Ubuntu package.

    Then there is not much more to say, than what is written in the INSTALL file of the Qwt tarball. Follow those advices step by step and ask if you have problems with one of them. This is much better than unspecific problem reports.

    Uwe

  7. #7
    Join Date
    Jan 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Unable to create qwtPlot object

    I did find a problem after i ran qmake everything was fine but while running make i got this error:

    compiling qwt_plot.cpp
    qwt_plot.cpp:10:22: fatal error: qwt_plot.h: No such file or directory
    compilation terminated.
    make[1]: *** [obj/qwt_plot.o] Error 1
    make[1]: Leaving directory `/home/jeff/Downloads/qwt-6.0.1/src'
    make: *** [sub-src-make_default-ordered] Error 2

    I tried it again and got this error:


    jeff@jeff-laptop:~/Downloads/qwt-6.0.1$ qmake
    jeff@jeff-laptop:~/Downloads/qwt-6.0.1$ make
    cd src/ && make -f Makefile
    make[1]: Entering directory `/home/jeff/.local/share/Trash/files/qwt-6.0.1/src'
    compiling qwt_plot.cpp
    qwt_plot.cpp:10:22: fatal error: qwt_plot.h: No such file or directory
    compilation terminated.
    make[1]: *** [obj/qwt_plot.o] Error 1
    make[1]: Leaving directory `/home/jeff/.local/share/Trash/files/qwt-6.0.1/src'
    make: *** [sub-src-make_default-ordered] Error 2

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

    Default Re: Unable to create qwtPlot object

    qwt_plot.h should be in the same directory as qwt_plot.cpp itself. If it is not there do a "svn update" to get a complete download.

    When the compiler error remains edit qwtbuild.pri and disable the line "CONFIG += silent". Then check the include path, that it is passed to the compiler.

    Uwe

Similar Threads

  1. how to create a curve in qwtplot?
    By ethanfeng in forum Qwt
    Replies: 1
    Last Post: 27th March 2011, 09:05
  2. Replies: 1
    Last Post: 6th May 2010, 11:05
  3. Replies: 1
    Last Post: 1st February 2010, 15:13
  4. Eclipse debugging: Unable to create variable object
    By PUK_999 in forum Installation and Deployment
    Replies: 0
    Last Post: 20th August 2009, 21:42
  5. QSQLITE Unable to fetch row in create
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 18th October 2006, 14:39

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.