PDA

View Full Version : qwt problem



robotics
13th June 2011, 16:20
I am trying out a simple random graph plot just to check the working of my library qwt.......
my code looks like following and I am getting error saying "C:\Qt\2010.05\qwt-build-desktop\debug\qwt.exe exited with code -1073741511"
please help me....my code is simple:::

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qwt.h"
#include "qwt_plot.h"
#include <QFileSystemWatcher>
#include "qwt_knob.h"
#include "cmath"
#include "qwt_curve_fitter.h"
#include "qwt_plot_curve.h"
#include "qwt_text.h"


MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_pushButton_clicked()
{
double xval[5]={10,20,30,40.4,50};
double yval[5]={1,2.2,3,4,5};
QwtPlot plot(QwtText("CppQwtExample1"));
plot.setTitle("first plot");
plot.setTitle("first_plot");
plot.setAxisTitle(QwtPlot::xBottom, " System time [h:m:s]");
plot.setAxisScale(QwtPlot::xBottom, 0,60 );
plot.setAxisTitle(QwtPlot::yLeft, "Degree");
plot.setAxisScale(QwtPlot::yLeft, -60,60 );
plot.setAutoReplot(true);
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
curve1->setPen(QPen(Qt::blue));
curve1->setRawSamples(xval,yval,5);
curve1->attach(&plot);
plot.replot();
plot.show();

}

robotics
14th June 2011, 17:48
seems like no one has the solution ....:(
please help me.....

SixDegrees
14th June 2011, 17:55
According to The Internet, you're linking against the wrong DLLs. Most likely, you're trying to run a debug version against non-debug DLLs, or vice-versa.

robotics
15th June 2011, 19:09
Is my code correct.....
please give me some sample code to check whether i have sucessfully built the library or not

norobro
16th June 2011, 01:35
Two comments re your code:

1) What do you think happens to "plot" when on_pushButton_clicked() ends?
2) Using setRawSamples() presents the same problem as item 1. From the Qwt docs (http://qwt.sourceforge.net/class_qwt_plot_curve.html#afd13c94e23520dacbc37b4d 0fd036a8b):
setRawSamples is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.

robotics
16th June 2011, 05:28
please provide me simple example of how to make a simple plot only consisting of axes only..........
I just want to check my qwt ...
please help me..:(

FelixB
16th June 2011, 07:39
can you compile the examples delivered with qwt?

norobro
16th June 2011, 14:03
As FelixB says, compiling the examples is the best test.

However, by creating "plot" on the heap and using setSamples() in lieu of setRawSamples() your code works for me (Qwt 6.0.0-rc3):
void MainWindow::on_pushButton_clicked()
{
double xval[5]={10,20,30,40.4,50};
double yval[5]={1,2.2,3,4,5};
QwtPlot *plot = new QwtPlot(QwtText("CppQwtExample1"));
// plot->setTitle("first plot");
plot->setTitle("first_plot");
plot->setAxisTitle(QwtPlot::xBottom, " System time [h:m:s]");
plot->setAxisScale(QwtPlot::xBottom, 0,60 );
plot->setAxisTitle(QwtPlot::yLeft, "Degree");
plot->setAxisScale(QwtPlot::yLeft, -60,60 );
plot->setAutoReplot(true); // not needed
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
curve1->setPen(QPen(Qt::blue));
curve1->setSamples(xval,yval,5);
curve1->attach(plot);
plot->replot(); // not needed
plot->show();
}

robotics
17th June 2011, 06:54
please provide me some examples..........and .pro file if you can........
that would be very helpful for me..
I am not been able to start
I am stuck here in my project.....
your help shall be highly appreciated...:D

TimeBomb
17th June 2011, 07:44
C:\Qt\2010.05\qwt-build-desktop\debug\qwt.exe exited with code -1073741511

We can get a lot more information if you actually use the debugger to find your errors. A problem like the above with -no other data- occurs 99% of the time without a debugger.

FelixB
17th June 2011, 07:56
please provide me some examples..........and .pro file if you can........
that would be very helpful for me..

you downloaded the qwt sources, didn't you? then you already have examples. these are in a directory called "examples" (surprisingly, isn't it?) in your qwt directory...