[Qt-interest] Qwt Error

Sujan Dasmahapatra sdh at lmglasfiber.com
Tue May 5 14:23:15 CEST 2009


This is my code could anyne check it plsss..This is not my own code its
taken from chap11 the new added chapter for Qwt.

////////////////////////////////////////////////////////////////////////
/////////
//Start
#include <QApplication>
#include <qwt_plot.h>
class MyPlot : public QwtPlot
{
public:
  MyPlot( QWidget *parent=0, char *name=0 ) : QwtPlot( parent)
  {
    // Show a title
    setTitle( "This is an Example" );

    // Show a legend at the bottom
    setAutoLegend( true );
    setLegendPos( Qwt::Bottom );

    // Show the axes
    setAxisTitle( xBottom, "x" );
    setAxisTitle( yLeft, "y" );

    // Insert two curves and get IDs for them
    long cSin = insertCurve( "y = sin(x)" );
    long cSign = insertCurve( "y = sign(sin(x))" );

    // Calculate the data, 500 points each
    const int points = 500;
    double x[ points ];
    double sn[ points ];
    double sg[ points ];

    for( int i=0; i<points; i++ )
    {
      x[i] = (3.0*3.14/double(points))*double(i);

      sn[i] = 2.0*sin( x[i] );
      sg[i] = (sn[i]>0)?1:((sn[i]<0)?-1:0);
    }

    // Copy the data to the plot
    setCurveData( cSin, x, sn, points );
    setCurveData( cSign, x, sg, points );

    // Set the style of the curves
   setCurvePen( cSin, QPen( blue ) );
    setCurvePen( cSign, QPen( green, 3 ) );

    // Show the plots
    replot();
  }
};


int main( int argc, char **argv )
{
  QApplication a( argc, argv );

  MyPlot p;
  a.setMainWidget( &p );
  p.show();

  return a.exec();
}
                                           
//END
////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////

/////////////Errors
//START
main.cpp:3:15: Qwt: No such file or directory
main.cpp: In constructor `MyPlot::MyPlot(QWidget*, char*)':
main.cpp:14: error: `setAutoLegend' was not declared in this scope
main.cpp:15: error: `Qwt' has not been declared
main.cpp:15: error: `Bottom' was not declared in this scope
main.cpp:15: error: `setLegendPos' was not declared in this scope
main.cpp:22: error: `insertCurve' was not declared in this scope
main.cpp:40: error: `setCurveData' was not declared in this scope
main.cpp:44: error: `blue' was not declared in this scope
main.cpp:44: error: `setCurvePen' was not declared in this scope
main.cpp:45: error: `green' was not declared in this scope
main.cpp:14: warning: unused variable 'setAutoLegend'
main.cpp:15: warning: unused variable 'Bottom'
main.cpp:15: warning: unused variable 'setLegendPos'
main.cpp:44: warning: unused variable 'blue'
main.cpp:45: warning: unused variable 'green'
main.cpp: In function `int main(int, char**)':
main.cpp:58: error: 'class QApplication' has no member named
'setMainWidget'
main.cpp: At global scope:
main.cpp:8: warning: unused parameter 'name'
make: *** [main.o] Error 1
//END
////////////////////////////////////////////////////////////////////////
////////////////

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Sean Harmer
Sent: Tuesday, May 05, 2009 5:33 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Qwt Error

On Tuesday 05 May 2009 12:57:29 Matthias Pospiech wrote:
> Srdjan Todorovic schrieb:
> > Hi,
> >
> > 2009/5/5 Sujan Dasmahapatra <sdh at lmglasfiber.com>:
> >> Still these are the errors I am getting Srdjian.I have included
> >> qwt_plot.h header.
>
> What are you compiling? An example that ships with qwt? 
Actually, I now I think he is trying to build an example meant to be
compiled 
against Qt 3.x.

Sujan, can you zip up your code and attach it to a message please so
that we 
can easily try it ourselves? Alternatively try an example meant for Qt
4.x.

Cheers,

Sean
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list