metRo_
9th November 2010, 00:49
I have downloaded Qwt and did qmake, make, make install.
Create a project basead in that: http://www.body-sensing.com/index.php?option=com_content&view=article&id=5:display-curves-with-a-qt-application&catid=5:divers&Itemid=6
This is what i have:
http://img130.imageshack.us/img130/7650/projectstruct.png
http://img301.imageshack.us/img301/5798/filesstruct.png
and this is the code:
testeempty.pro
SOURCES += \
main.cpp \
dataplot.cpp
HEADERS += \
dataplot.h
QWT_DIR = /qwt-521
INCLUDEPATH += $$QWT_DIR/include
CONFIG(debug, debug|release):LIBS += -L$$QWT_DIR\lib\ \
-lqwtd5
else:LIBS += -L$$QWT_DIR\lib\ \
-lqwt5
DEFINES += QWT_DLL
dataplot.h
#ifndef DATAPLOT_H
#define DATAPLOT_H
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_array.h>
#include <qwt_math.h>
class CurveData
{
public:
CurveData( int size );
const double *x() const;
const double *y() const;
QwtArray<double> d_x;
QwtArray<double> d_y;
};
class DataPlot : public QwtPlot
{
public:
DataPlot( QWidget* = NULL );
QwtPlotCurve* curve;
};
#endif // DATAPLOT_H
dataplot.cpp
#include "dataplot.h"
CurveData::CurveData( int size )
{
d_x.resize( size );
d_y.resize( size );
// Initialize data
for (int i = 0; i< size; i++)
{
d_x[i] = 0.5 * i; // time axis
d_y[i] = 0;
}
}
const double *CurveData::x() const
{
return d_x.data();
}
const double *CurveData::y() const
{
return d_y.data();
}
DataPlot::DataPlot( QWidget* parent ): QwtPlot( parent )
{
setAxisScale( yLeft , -1 , 1 );
// Create curve
curve = new QwtPlotCurve();
curve->attach( this );
}
main.cpp
#include <QApplication>
#include <QMainWindow>
#include "dataplot.h"
const int PLOT_SIZE = 201;
class MainWindow : public QMainWindow
{
public:
MainWindow()
{
data = new CurveData( PLOT_SIZE );
plot = new DataPlot;
plot->setTitle( QString("Simple Qwt Usage") );
plot->curve->setRawData( data->x() , data->y() , PLOT_SIZE );
setCentralWidget( plot );
startTimer( 20 );
}
private:
DataPlot* plot;
CurveData* data;
virtual void timerEvent( QTimerEvent* e );
};
void MainWindow::timerEvent( QTimerEvent* )
{
static double phase = 0.0;
for ( int i = PLOT_SIZE - 1; i > 0; i-- )
data->d_y[i] = data->d_y[i-1];
data->d_y[0] = sin( phase );
plot->replot();
phase += M_PI * 0.02;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow mw;
mw.resize(500,300);
mw.show();
return a.exec();
}
And the now the error:
Running build steps for project testeempty...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
/usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile ../testeempty/testeempty.pro
WARNING: /home/ze/Documentos/Qt/testeempty/testeempty.pro:13: Unescaped backslashes are deprecated.
make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQWT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testeempty -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/qwt-521/include -I. -I../testeempty -I. -o main.o ../testeempty/main.cpp
In file included from ../testeempty/main.cpp:3:
../testeempty/dataplot.h:4: fatal error: qwt_plot.h: No such file or directory
compilation terminated.
make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
make: *** [main.o] Error 1
The process "/usr/bin/make" exited with code %2.
Error while building project testeempty (target: Desktop)
When executing build step 'Make'
Can anyone help me?!
Create a project basead in that: http://www.body-sensing.com/index.php?option=com_content&view=article&id=5:display-curves-with-a-qt-application&catid=5:divers&Itemid=6
This is what i have:
http://img130.imageshack.us/img130/7650/projectstruct.png
http://img301.imageshack.us/img301/5798/filesstruct.png
and this is the code:
testeempty.pro
SOURCES += \
main.cpp \
dataplot.cpp
HEADERS += \
dataplot.h
QWT_DIR = /qwt-521
INCLUDEPATH += $$QWT_DIR/include
CONFIG(debug, debug|release):LIBS += -L$$QWT_DIR\lib\ \
-lqwtd5
else:LIBS += -L$$QWT_DIR\lib\ \
-lqwt5
DEFINES += QWT_DLL
dataplot.h
#ifndef DATAPLOT_H
#define DATAPLOT_H
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_array.h>
#include <qwt_math.h>
class CurveData
{
public:
CurveData( int size );
const double *x() const;
const double *y() const;
QwtArray<double> d_x;
QwtArray<double> d_y;
};
class DataPlot : public QwtPlot
{
public:
DataPlot( QWidget* = NULL );
QwtPlotCurve* curve;
};
#endif // DATAPLOT_H
dataplot.cpp
#include "dataplot.h"
CurveData::CurveData( int size )
{
d_x.resize( size );
d_y.resize( size );
// Initialize data
for (int i = 0; i< size; i++)
{
d_x[i] = 0.5 * i; // time axis
d_y[i] = 0;
}
}
const double *CurveData::x() const
{
return d_x.data();
}
const double *CurveData::y() const
{
return d_y.data();
}
DataPlot::DataPlot( QWidget* parent ): QwtPlot( parent )
{
setAxisScale( yLeft , -1 , 1 );
// Create curve
curve = new QwtPlotCurve();
curve->attach( this );
}
main.cpp
#include <QApplication>
#include <QMainWindow>
#include "dataplot.h"
const int PLOT_SIZE = 201;
class MainWindow : public QMainWindow
{
public:
MainWindow()
{
data = new CurveData( PLOT_SIZE );
plot = new DataPlot;
plot->setTitle( QString("Simple Qwt Usage") );
plot->curve->setRawData( data->x() , data->y() , PLOT_SIZE );
setCentralWidget( plot );
startTimer( 20 );
}
private:
DataPlot* plot;
CurveData* data;
virtual void timerEvent( QTimerEvent* e );
};
void MainWindow::timerEvent( QTimerEvent* )
{
static double phase = 0.0;
for ( int i = PLOT_SIZE - 1; i > 0; i-- )
data->d_y[i] = data->d_y[i-1];
data->d_y[0] = sin( phase );
plot->replot();
phase += M_PI * 0.02;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow mw;
mw.resize(500,300);
mw.show();
return a.exec();
}
And the now the error:
Running build steps for project testeempty...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
/usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile ../testeempty/testeempty.pro
WARNING: /home/ze/Documentos/Qt/testeempty/testeempty.pro:13: Unescaped backslashes are deprecated.
make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQWT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../testeempty -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/qwt-521/include -I. -I../testeempty -I. -o main.o ../testeempty/main.cpp
In file included from ../testeempty/main.cpp:3:
../testeempty/dataplot.h:4: fatal error: qwt_plot.h: No such file or directory
compilation terminated.
make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
make: *** [main.o] Error 1
The process "/usr/bin/make" exited with code %2.
Error while building project testeempty (target: Desktop)
When executing build step 'Make'
Can anyone help me?!