Important: Please read the Qt Code of Conduct -

Qwtplot3d with Qt 5, Qt Creator and MinGW?

  • I'm beginning to learn Qt, and about four months into my project I need to incorporate 3-dimensional plotting into it. From what I've heard, Qwtplot3d should be a suitable tool to use. The concept of linking to libraries in my project is new ground for me, though.

    Compiling Qwtplot3d in Qt Creator was relatively smooth. I've ended up with the files libqwtplot3d.lib, libqwtplot3dd.lib, qwtplot3d.dll and qwtplot3dd.dll (located in a subdirectory to the debug build folder). Using the library, however, is more problematic.

    As a test, I've created a project with a pushbutton, and connected the click event of this button to the code

    @1.SurfacePlot *plot3 = new SurfacePlot(this);@

    When clicking the button, my program crashes with the error message "QWidget: Must construct a QApplication before a QPaintDevice", even though I've already did construct my QApplication back in main.cpp. It's quite similar to the error in this thread, but as far as I can tell I'm building both the libraries and my test project in debug mode:

    My first thought was that it was a user error, so I proceeded to test the example projects that are distributed with Qwtplot3d. I did get them to build after a few minor modifications, but they all crash immediately with the text "The program has unexpectedly finished."

    I'm using Qt Creator with Qt 5 on Windows, with the mingw compiler.

    Any suggestions as to where I go from here? Does anybody know of any known issues with Qwtplot3d combined with Qt 5?

    Below is the first part of the .pro file of my test project. Am I doing something wrong when linking to the library?

    @QT += core gui
    QT += printsupport
    QT += opengl

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    INCLUDEPATH += "D:/Qt/qwtplot3d/include"
    LIBS += D:/Qt/build-qwtplot3d-Desktop_Qt_5_1_0_MinGW_32bit-Debug/lib/qwtplot3d.dll

    TARGET = EngineMatch_1
    TEMPLATE = app@

    Grateful for any help or advice. I'm quite stuck at the moment.

Log in to reply