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
include (E:/Data/Qt_Creator_Projects/qwtInclude.pri)
TARGET = DriveCycle
DESTDIR_TARGET = E:/Data/Qt_Creator_Projects/bin/DriveCycle
# TEMPLATE = app
SOURCES = main.cpp \
plotterdialog.cpp
HEADERS = plotterdialog.h
include (E:/Data/Qt_Creator_Projects/qwtInclude.pri)
TARGET = DriveCycle
DESTDIR_TARGET = E:/Data/Qt_Creator_Projects/bin/DriveCycle
# TEMPLATE = app
SOURCES = main.cpp \
plotterdialog.cpp
HEADERS = plotterdialog.h
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QtGui/QApplication>
#include "plotterdialog.h"
int main(int argc, char *argv[])
{
PlotterDialog w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "plotterdialog.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
PlotterDialog w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
plotterdialog.cpp
#include "plotterdialog.h"
#include <QHBoxLayout>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_text.h>
PlotterDialog
::PlotterDialog(QWidget *parent
){
lbl1
= new QLabel(tr
("Good Morning"));
hbl1->addWidget(lbl1);
double x[100], y1[100], y2[100];
myPlot
= new QwtPlot(txt1
->text
(),parent
);
//hbl1->addWidget(qPlot);
setLayout(hbl1);
}
PlotterDialog::~PlotterDialog()
{
}
#include "plotterdialog.h"
#include <QHBoxLayout>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_text.h>
PlotterDialog::PlotterDialog(QWidget *parent)
: QWidget(parent)
{
lbl1 = new QLabel(tr("Good Morning"));
hbl1= new QHBoxLayout;
hbl1->addWidget(lbl1);
QwtText *txt1;
txt1 = new QwtText("Two Curves");
QwtPlot *myPlot;
double x[100], y1[100], y2[100];
myPlot = new QwtPlot(txt1->text(),parent);
//hbl1->addWidget(qPlot);
setLayout(hbl1);
}
PlotterDialog::~PlotterDialog()
{
}
To copy to clipboard, switch view to plain text mode
plotterdialog.h
#ifndef PLOTTERDIALOG_H
#define PLOTTERDIALOG_H
#include <QtGui/QDialog>
#include <QtGui>
#include "plotter.h"
//#include <qwt_plot.h>
class PlotterDialog
: public QWidget{
Q_OBJECT
public:
PlotterDialog
(QWidget *parent
= 0);
~PlotterDialog();
};
#endif // PLOTTERDIALOG_H
#ifndef PLOTTERDIALOG_H
#define PLOTTERDIALOG_H
#include <QtGui/QDialog>
#include <QtGui>
#include "plotter.h"
//#include <qwt_plot.h>
class QLabel;
class QHBoxLayout;
class PlotterDialog : public QWidget
{
Q_OBJECT
public:
PlotterDialog(QWidget *parent = 0);
~PlotterDialog();
QLabel* lbl1;
QHBoxLayout* hbl1;
};
#endif // PLOTTERDIALOG_H
To copy to clipboard, switch view to plain text mode
qwtInclude.pri (included in DriveCycle.pro)
QT_ROOT = C:/Qt/QtCreator/Qt
QWT_ROOT = C:/qwt-5.1.1
MINGW_ROOT = C:/Qt/QtCreator/mingw
MyProjectRoot = E:/Data/QT_Creator_Projects/
SUFFIX_STR =
VVERSION = $$[QT_VERSION]
isEmpty(VVERSION) {
# Qt 3
debug {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
else {
CONFIG(debug, debug|release) {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
TEMPLATE = app
MOC_DIR = moc
INCLUDEPATH += $${QWT_ROOT}/src\
$${QWT_ROOT}/include/qwt5\
$${QT_ROOT}/include\
$${QT_ROOT}/bin\
$${MINGW_ROOT}/include\
$${MINGW_ROOT}/bin\
$${MINGW_ROOT}/lib
DEPENDPATH += $${QWT_ROOT}/src
OBJECTS_DIR = obj$${SUFFIX_STR}
DESTDIR = $${MyProjectRoot}/bin/$${SUFFIX_STR}
QMAKE_LIBDIR +=$${MINGW_ROOT}/lib
QWTLIB = qwt$${SUFFIX_STR}
win32 {
contains(CONFIG, QwtDll) {
DEFINES += QT_DLL QWT_DLL
QWTLIB = $${QWTLIB}$${VER_MAJ}
}
win32-msvc:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-msvc.net:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-msvc2005:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-g++:LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
}
else {
LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
}
# LIBS += $${QWT_ROOT}/lib/qwtd5.dll
LIBS -lqwt5
QT_ROOT = C:/Qt/QtCreator/Qt
QWT_ROOT = C:/qwt-5.1.1
MINGW_ROOT = C:/Qt/QtCreator/mingw
MyProjectRoot = E:/Data/QT_Creator_Projects/
SUFFIX_STR =
VVERSION = $$[QT_VERSION]
isEmpty(VVERSION) {
# Qt 3
debug {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
else {
CONFIG(debug, debug|release) {
SUFFIX_STR = $${DEBUG_SUFFIX}
}
else {
SUFFIX_STR = $${RELEASE_SUFFIX}
}
}
TEMPLATE = app
MOC_DIR = moc
INCLUDEPATH += $${QWT_ROOT}/src\
$${QWT_ROOT}/include/qwt5\
$${QT_ROOT}/include\
$${QT_ROOT}/bin\
$${MINGW_ROOT}/include\
$${MINGW_ROOT}/bin\
$${MINGW_ROOT}/lib
DEPENDPATH += $${QWT_ROOT}/src
OBJECTS_DIR = obj$${SUFFIX_STR}
DESTDIR = $${MyProjectRoot}/bin/$${SUFFIX_STR}
QMAKE_LIBDIR +=$${MINGW_ROOT}/lib
QWTLIB = qwt$${SUFFIX_STR}
win32 {
contains(CONFIG, QwtDll) {
DEFINES += QT_DLL QWT_DLL
QWTLIB = $${QWTLIB}$${VER_MAJ}
}
win32-msvc:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-msvc.net:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-msvc2005:LIBS += $${QWT_ROOT}/lib/$${QWTLIB}.lib
win32-g++:LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
}
else {
LIBS += -L$${QWT_ROOT}/lib -l$${QWTLIB}
}
# LIBS += $${QWT_ROOT}/lib/qwtd5.dll
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!
Bookmarks