Results 1 to 9 of 9

Thread: QwtPlot : hello world! simple instructions for the first 2d plot

  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QwtPlot : hello world! simple instructions for the first 2d plot

    hi there!
    i am trying to make my first 2d plot using the example from:
    http://qwt.sourceforge.net/class_qwt_plot.html#_details

    and i get error related to the constructor:

    main.cpp:61: error: no matching function for call to ‘QwtPlot::QwtPlot(const char [11], int, int)’

    my main is pretty simple:
    #include <QApplication>
    #include <QFont>
    #include <QGridLayout>
    #include <QPushButton>

    #include "cannonfield.h"
    #include "lcdrange.h"

    #include <qwt_plot.h>
    #include <qwt_plot_curve.h>
    #include <qwt_text.h>

    class MyWidget : public QWidget
    {
    public:
    MyWidget(QWidget *parent = 0);
    };


    MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
    {

    ...................

    QwtPlot *myPlot = new QwtPlot("Two Curves", 0, 0);



    .....................
    }


    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    MyWidget widget;
    widget.setGeometry(100, 100, 500, 355);
    widget.show();
    return app.exec();
    }


    my .pro file looks like
    TEMPLATE = app
    TARGET =
    DEPENDPATH += .
    INCLUDEPATH += . /home/spectro/Documents/postdoc/qt/qwtHOME/src/
    CONFIG += qwt /home/spectro/Documents/postdoc/qt/qwtHOME/src/

    # Input
    HEADERS += cannonfield.h lcdrange.h
    SOURCES += cannonfield.cpp lcdrange.cpp main.cpp
    Has this error to do with the installation/configuration files?

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

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    Quote Originally Posted by fatecasino View Post
    main.cpp:61: error: no matching function for call to ‘QwtPlot::QwtPlot(const char [11], int, int)’
    What means, that there is no matching function for call to ‘QwtPlot::QwtPlot(const char [11], int, int)´ at main.cpp:61.

    Check the available constructors of QwtPlot in the docs.

    Uwe

  3. #3
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    exactly that's my question!!
    Public Member Functions

    QwtPlot (QWidget *=NULL)
    QwtPlot (const QwtText &title, QWidget *p=NULL)

    changed it to
    QwtPlot *myPlot = new QwtPlot(QwtText("Two Curves"), parent);
    and new error appeared
    /main.cpp:61: error: undefined reference to `QwtText::QwtText(QString const&, QwtText::TextFormat)'

    my .pro has INCLUDEPATH that definetely contains the #include <qwt_text.h>
    There must be a problem here?!

    Generally speaking (i am an experienced researcher/programmer), i think that a tutorial constructing simple plots from scratch, with some working programs and .pro files would help. Most tutorials in the web were "schematic" causing much more confusion than helping.

  4. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    did you notice that there are some examples delivered with qwt? of course that's not the same as a good detailed tutorial, but these examples helped me a lot!

  5. #5
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    i really cannot understand why people spend tens of weeks in programming qwt and they don't spend a single day in writing two very basic things.
    -->How to configure analytically/correctly qwt in some basic systems (linux,windows)
    -->hello world program (a simple 2d plot with 1 curve on it)
    There are hundreds of posts trying to configure libraries, links, etc,etc. It's totally ridiculous.All configuration instructions are "schematic", meaningless, do this, link this, link that..
    As about these famous examples,they are the funniest examples ever. They should not call "examples", it's a confusing title.They should be called "Demo", as they simple demonstrate what qwt can do. These examples are totally a waste of time because they are simply oriented and helpful for someone who ALREADY knows qwt well.

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

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    Quote Originally Posted by fatecasino View Post
    -->How to configure analytically/correctly qwt in some basic systems (linux,windows)
    Well on linux the answer is pretty simple ( maybe not that simple as it depends on your distribution ): install the precompiled packages using the package manager.

    But as soon as you want to build/install Qwt on your own you have to follow the steps described in INSTALL.

    Qwt 5.2 had more than 10000 downloads only from sourceforge. But nobody had ever sent me changes for the text of the INSTALL file - for any platform. So maybe the information is enough, but if not - feel free to contribute a more schematic guide.

    error: undefined reference to `QwtText::QwtText(QString const&, QwtText::TextFormat)'
    Do you really want me to explain the difference between linker and compiler and how to tell the linker about libraries you want to link to your application ?

    Maybe you missed to read the INSTALL file. At the end you find the following:

    Using Qwt
    ===========

    For building a Qwt application with qmake use the Qwt configuration features
    file, that has been installed by "make install". When qmake is able to find
    it ( http://doc.qt.nokia.com/4.7/qmake-ad...ation-features )
    you can simply add "CONFIG += qwt" to your application project file.

    If you don't use qmake you have to add the include path to find the Qwt
    headers to your compiler flags and the Qwt library to your linker list.
    Don't forget to add QWT_DLL to the compiler flags, when you work with
    Qwt-DLLs on Windows.
    I'm not sure how to handle your posting - you couldn't fix a very simple compiler error about a wrong signature and didn't understand the linker error about a missing symbol.

    Obviously you are a Qt and C++ beginner - no problem, we all started once - but this is no excuse for being rude.

    Uwe

  7. #7
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    Quote Originally Posted by fatecasino View Post
    As about these famous examples,they are the funniest examples ever. They should not call "examples", it's a confusing title.They should be called "Demo", as they simple demonstrate what qwt can do. These examples are totally a waste of time because they are simply oriented and helpful for someone who ALREADY knows qwt well.
    I started with qwt some weeks ago. I didn't know anything about it - now I have created a complex image analysis tool with several qwt plots. The examples helped me a lot: installing a zoomer, setting plot markers, creating a spectrogram... yes, the documentation could be better. But don't forget - qwt is not a commercial tool! So you better thank Uwe for programming all this gerat things instead of blaming him because you miss better tutorials.

  8. #8
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    @Uwe
    it's not about being rude, but simply being sincere. Of course there are thousands of downloads as long researchers don't want to give their money to MATLAB. BUT, in the fora there are lots of puzzled people asking about linking problems (haven't you googled it?). Sure, "CONFIG += qwt" was in my .pro files since the very first day and that didn't help that much. I included "/usr/local/qwt-6.0.0-rc5/include" (other locations in the end)and not so much progress. After that point I started googling it. In order to compile and make qwt you have probably to add several other lines in the .pro. Everyone suggests something completely different, and you end up totally confused. The official installation instructions are not detailed and explicit. In other words, of course I know i have to link the new libraries, but what can you do when the proper/obvious way does not work.

    @FelixB
    A non-commercial software product is still a product, and i don't see the reason of having lower quality standards than those of the commercial ones. Free does not necessarily mean unsupported. Look at http://qwt.sourceforge.net/ for example. It's the most discouraging software product web page I have ever seen. It looks as it has been designed back in '90s.

    Anyway, I do not mean of being mean or rude. It's just I think that unbiased criticism is a good base for progress. With a better website and analytical documentation tutorials, qwt would have an even greater success and popularity among programmers.

  9. #9
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,241
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot : hello world! simple instructions for the first 2d plot

    Of course there are thousands of downloads as long researchers don't want to give their money to MATLAB.
    No, Qwt is not a replacement for MATLAB - it's not even intended to be one. It's an extension of the Qt library for writing Qt applications with a technical background. The intended audience are developers of Qt applications - assuming a certain level of experience with C++ and Qt and their favorite operating system.

    But indeed there are users that expect a replacement of MATLAB, where they get things done without having to dive into details of software development. Exactly those users are sometimes frustrated, when they notice, that writing a Qt/Qwt application is above their head.

    After that point I started googling it. In order to compile and make qwt you have probably to add several other lines in the .pro. Everyone suggests something completely different, and you end up totally confused.
    You are using a release candidate of Qwt 6, while most of the postings are for earlier Qwt releases.

    Again, why don't you simply follow the steps documented in the INSTALL file. When you run into a problem report it here with informations about your environment and the steps you did - instead of ...

    Look at http://qwt.sourceforge.net/ for example. It's the most discouraging software product web page I have ever seen. It looks as it has been designed back in '90s.
    Well - not discouraging enough for you.

    I'm completely uninterested in spending time on designing web pages and if nobody else is doing something nicer it will probably never change. Please note, that I don't want to sell something !

    Uwe
    Last edited by Uwe; 24th November 2010 at 23:23.

Similar Threads

  1. Replies: 12
    Last Post: 31st October 2010, 17:08
  2. Replies: 1
    Last Post: 30th July 2010, 07:23
  3. Replies: 1
    Last Post: 1st February 2010, 15:13
  4. Replies: 4
    Last Post: 14th May 2009, 10:31
  5. simple hello world question
    By chap19150 in forum Qt Programming
    Replies: 12
    Last Post: 11th July 2006, 19:42

Tags for this Thread

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.