Results 1 to 9 of 9

Thread: Qwt Data_Plot Example Runtime Error

  1. #1
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Question Qwt Data_Plot Example Runtime Error

    Hello all,
    Firstly I am running QtCreator 0.9.2 / with Qt 4.5.0, on Windows Vista Business.

    I followed the install instructions for qwt; and also built the examples at time of install. Next I opened the pro file of the example (data_plot) through QtCreator and everything worked nicely. (Had to add C:\qt\qtcreator\qt\bin; C:\qt\qtcreator\mingw\bin; c:\qwt-5.1.1\bin to the PATH Variable.)

    After spending some time trying to apply the same concepts as the example in my own simple QDialog, I ran into an error on both Run and Debug: "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.", Titled: "Microsoft Visual C++ Runtime Library". The Application Output window of QT Creator displays:
    "Starting e:/data/qt_creator_projects/bin/DriveCycle.exe..."
    "Invalid parameter passed to C runtime function."
    "Invalid parameter passed to C runtime function."
    ""
    "e:/data/qt_creator_projects/bin/DriveCycle.exe exited with code 3".

    Here are the files I am working with:

    DriveCycle.pro
    Qt Code:
    1. include (E:/Data/Qt_Creator_Projects/qwtInclude.pri)
    2. TARGET = DriveCycle
    3. DESTDIR_TARGET = E:/Data/Qt_Creator_Projects/bin/DriveCycle
    4.  
    5. # TEMPLATE = app
    6. SOURCES = main.cpp \
    7. plotterdialog.cpp
    8. HEADERS = plotterdialog.h
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "plotterdialog.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. PlotterDialog w;
    8. w.show();
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    plotterdialog.cpp
    Qt Code:
    1. #include "plotterdialog.h"
    2. #include <QHBoxLayout>
    3. #include <qwt_plot.h>
    4. #include <qwt_plot_curve.h>
    5. #include <qwt_text.h>
    6.  
    7. PlotterDialog::PlotterDialog(QWidget *parent)
    8. : QWidget(parent)
    9. {
    10. lbl1 = new QLabel(tr("Good Morning"));
    11. hbl1= new QHBoxLayout;
    12. hbl1->addWidget(lbl1);
    13. QwtText *txt1;
    14. txt1 = new QwtText("Two Curves");
    15. QwtPlot *myPlot;
    16. double x[100], y1[100], y2[100];
    17. myPlot = new QwtPlot(txt1->text(),parent);
    18. //hbl1->addWidget(qPlot);
    19. setLayout(hbl1);
    20.  
    21. }
    22.  
    23. PlotterDialog::~PlotterDialog()
    24. {
    25.  
    26. }
    To copy to clipboard, switch view to plain text mode 

    plotterdialog.h
    Qt Code:
    1. #ifndef PLOTTERDIALOG_H
    2. #define PLOTTERDIALOG_H
    3.  
    4. #include <QtGui/QDialog>
    5. #include <QtGui>
    6.  
    7. #include "plotter.h"
    8. //#include <qwt_plot.h>
    9.  
    10. class QLabel;
    11. class PlotterDialog : public QWidget
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. PlotterDialog(QWidget *parent = 0);
    17. ~PlotterDialog();
    18. QLabel* lbl1;
    19. QHBoxLayout* hbl1;
    20.  
    21.  
    22. };
    23.  
    24. #endif // PLOTTERDIALOG_H
    To copy to clipboard, switch view to plain text mode 

    qwtInclude.pri (included in DriveCycle.pro)
    Qt Code:
    1. QT_ROOT = C:/Qt/QtCreator/Qt
    2. QWT_ROOT = C:/qwt-5.1.1
    3. MINGW_ROOT = C:/Qt/QtCreator/mingw
    4. MyProjectRoot = E:/Data/QT_Creator_Projects/
    5.  
    6. SUFFIX_STR =
    7. VVERSION = $$[QT_VERSION]
    8. isEmpty(VVERSION) {
    9.  
    10. # Qt 3
    11. debug {
    12. SUFFIX_STR = $${DEBUG_SUFFIX}
    13. }
    14. else {
    15. SUFFIX_STR = $${RELEASE_SUFFIX}
    16. }
    17. }
    18. else {
    19. CONFIG(debug, debug|release) {
    20. SUFFIX_STR = $${DEBUG_SUFFIX}
    21. }
    22. else {
    23. SUFFIX_STR = $${RELEASE_SUFFIX}
    24. }
    25. }
    26.  
    27. TEMPLATE = app
    28.  
    29. MOC_DIR = moc
    30. INCLUDEPATH += $${QWT_ROOT}/src\
    31. $${QWT_ROOT}/include/qwt5\
    32. $${QT_ROOT}/include\
    33. $${QT_ROOT}/bin\
    34. $${MINGW_ROOT}/include\
    35. $${MINGW_ROOT}/bin\
    36. $${MINGW_ROOT}/lib
    37.  
    38.  
    39. DEPENDPATH += $${QWT_ROOT}/src
    40. OBJECTS_DIR = obj$${SUFFIX_STR}
    41. DESTDIR = $${MyProjectRoot}/bin/$${SUFFIX_STR}
    42. QMAKE_LIBDIR +=$${MINGW_ROOT}/lib
    43.  
    44. QWTLIB = qwt$${SUFFIX_STR}
    45.  
    46. win32 {
    47. contains(CONFIG, QwtDll) {
    48. DEFINES += QT_DLL QWT_DLL
    49. QWTLIB = $${QWTLIB}$${VER_MAJ}
    50. }
    51.  
    52. win32-msvc:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
    53. win32-msvc.net:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
    54. win32-msvc2005:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
    55. win32-g++:LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
    56. }
    57. else {
    58. LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
    59.  
    60. }
    61. # LIBS += $${QWT_ROOT}/lib/qwtd5.dll
    62. LIBS -lqwt5
    To copy to clipboard, switch view to plain text mode 

    Application Output:
    Starting e:/Data/QT_Creator_Projects/bin/DriveCycle.exe...
    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.

    e:/Data/QT_Creator_Projects/bin/DriveCycle.exe exited with code 3

    Much of the qwtInclude.pri was taken based on the data_plot example from the qwt-5.1.1 installed examples. As I said earlier, the example runs fine from its installed directory. So then I thought I would make a complete copy of the data_plot example in a new folder under qwt-5.1.1/examples called "mytest", in this folder I copied completely the main.cpp, data_plot.cpp, data_plot.h, and data_plot.pro; opened the pro file in qt creator and tried to run, which should be identical to the original example, and it duplicates the same error I experienced before. Any help/insight would be most welcome, I have been scouring the web looking for helpful hints related to this for a couple days now, which is partially why the pri file above has so many entries...

    The only difference I have found so far between my 2 non-working versions and the working example is in the "Build Steps" -> "QMake"->"Arguments" (which are not changable from this screen):
    Working example (qwt-5.1.1/examples/data_plot...):
    "C:/qwt-5.1.1/examples/data_plot/data_plot.pro -spec win32-g++ -r"
    Non-working examples (both) (qwt-5.1.1/examples/MyTest...):
    "C:/qwt-5.1.1/examples/MyTest/data_plot.pro -spec win32-g++ -r CONFIG +=debug_and_release".

    The only conclusions I have been able to draw from this so far is that the extra CONFIG statement must be a setting in QtCreator? Don't know if this is even remotely related to the issues I am seeing, just an observation.

    Thanks to all in advance for the help, it is much appreciated!

  2. #2
    Join Date
    Mar 2009
    Location
    Saint Petersburg, Russia
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    Probably there will be no runtime error if you build and run the release version, that's what happening with my test qwt projects. I don't understand why.

  3. #3
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    I have the same runtime errors.
    Before, under XP, no problems.
    But porting the same application under Vista fires this error.
    I don't know if it's a problem of Qwt or Qt 4.5.
    Waiting for help

  4. #4
    Join Date
    May 2008
    Posts
    276
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    I solved, or at least I reached a working solution.
    My experience is as follows:

    (First delete CONFIG += debug_and_release from your src.pro


    Qt 4.5 + Qwt-5.2 ---> Doesn't work (Runtime errors)
    Qt 4.5 + Qwt-5.1 ---> Works
    Qt 4 + Qwt 5.1 ----> Works


    I cannot figure out what does cause that configuration variable at all.

  5. The following user says thank you to giusepped for this useful post:

    AlphaWolfXV (14th April 2009)

  6. #5
    Join Date
    Aug 2008
    Posts
    38
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    Thanks to all for your suggestions. It is now working... Thanks again!

  7. #6
    Join Date
    Aug 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    I'm using Qt 4.5.2 with Qwt 5.2.0 on Windows XP and it works with release builds (same error with debug release), so it seems to be caused not by issues with the versions, but by some settings.

  8. #7
    Join Date
    Aug 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt Data_Plot Example Runtime Error

    i have the same problem. i port a linux app to windows. my project compiles . but when i start the app i get an runtime error. i have no idea , how to solve this problem. does anybody solve his problem?

  9. #8
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Qwt Data_Plot Example Runtime Error

    Hi,

    I'm a newbie in the Qt - world and I'm starting to use the Qt environment and Qwt. I'm also experimenting that problem.

    I'm writting a simple example based on realtime_plot and I get the same runtime error (either in debug or release version) when I execute it. The offending code is this:

    MainWindow::MainWindow() : QMainWindow(){

    addToolBar(toolBar());

    d_plot = new RandomPlot(this); //<--- The error is raised here. d_plot is an object of class RandomPlot.
    d_plot->setMargin(4);
    setCentralWidget(d_plot);


    initWhatsThis();
    setAttribute(Qt::WA_DeleteOnClose);
    }



    I did some research and just found that the problem may be in the classes inheriting from QFrame but I cannot figure out what the problem is. I'm running Qt-Creator 4.6.0 and Qwt 5.2.0.

    Regards,


    Juan

  10. #9
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Qwt Data_Plot Example Runtime Error

    It's me again!

    I think I found a solution to the problem.... I followed these steps (which were already posted in another thread) http://www.qtcentre.org/threads/2617...178#post127178.

    Now my first QWT application is up and running.

    I hope it can help.


    Regards,


    Juan.

Similar Threads

  1. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 10:15
  2. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  3. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  4. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  5. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19

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.