[Qt-interest] QWt Errors

Sujan Dasmahapatra sdh at lmglasfiber.com
Tue May 5 11:52:23 CEST 2009


Plss see the errors below while I tried to compile chap 11's 1st code
simply plotting a curve.....

See also the code below

////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

main.cpp: In constructor `MyPlot::MyPlot(QWidget*, char*)':

main.cpp:7: error: no matching function for call to
`QwtPlot::QwtPlot(QWidget*&, char*&)'

/usr/local/include/qwt_plot.h:73: note: candidates are:
QwtPlot::QwtPlot(const QwtPlot&)

/usr/local/include/qwt_plot.h:130: note:
QwtPlot::QwtPlot(const QwtText&, QWidget*)

/usr/local/include/qwt_plot.h:129: note:
QwtPlot::QwtPlot(QWidget*)

main.cpp:12: error: `setAutoLegend' was not declared in this scope

main.cpp:13: error: `Qwt' has not been declared

main.cpp:13: error: `Bottom' was not declared in this scope

main.cpp:13: error: `setLegendPos' was not declared in this scope

main.cpp:20: error: `insertCurve' was not declared in this scope

main.cpp:38: error: `setCurveData' was not declared in this scope

main.cpp:42: error: `blue' was not declared in this scope

main.cpp:42: error: invalid use of undefined type `struct QPen'

/usr/local/pack/Qt-4.4.3/include/QtGui/qwindowdefs.h:69: error: forward
declaration of `struct QPen'

main.cpp:42: error: `setCurvePen' was not declared in this scope

main.cpp:43: error: `green' was not declared in this scope

main.cpp:43: error: invalid use of undefined type `struct QPen'

/usr/local/pack/Qt-4.4.3/include/QtGui/qwindowdefs.h:69: error: forward
declaration of `struct QPen'

main.cpp:12: warning: unused variable 'setAutoLegend'

main.cpp:13: warning: unused variable 'Bottom'

main.cpp:13: warning: unused variable 'setLegendPos'

main.cpp:42: warning: unused variable 'blue'

main.cpp:43: warning: unused variable 'green'

main.cpp: In function `int main(int, char**)':

main.cpp:56: error: 'class QApplication' has no member named
'setMainWidget'

make: *** [main.o] Error 1

 

////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

///see the code below

////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////

#include <QApplication>

#include <qwt_plot.h>

class MyPlot : public QwtPlot

{

public:

  MyPlot( QWidget *parent=0, char *name=0 ) : QwtPlot( parent, name )

  {

    // 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();

}

                        

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///////

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////

 

 

 

 

 

Kind regards, 
LM Glasfiber R&D (India) Pvt. Ltd.
 
Sujan Dasmahapatra
Project Engineer - CFD
  
Telephone: +91 80 66470248 
Mobile: 
E-mail: sdh at lmglasfiber.com <mailto:sdh at lmglasfiber.com>  

 

 

 

 

--------------------------------------------------------------

This e-mail and any attachments are confidential. If you are not the
named or intended recipient, please notify the sender immediately and do
not disclose the contents to any other person, use it for any purpose or
store or copy the information in any medium. Any unauthorized
disclosure, use or storage is prohibited and might be unlawful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090505/8ce1acf4/attachment.html 


More information about the Qt-interest-old mailing list