Results 1 to 6 of 6

Thread: First Project with Qwt - qwt_plot.h: No such file or directory

  1. #1
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default First Project with Qwt - qwt_plot.h: No such file or directory

    I have downloaded Qwt and did qmake, make, make install.
    Create a project basead in that: http://www.body-sensing.com/index.ph...ivers&Itemid=6

    This is what i have:



    and this is the code:
    testeempty.pro
    Qt Code:
    1. SOURCES += \
    2. main.cpp \
    3. dataplot.cpp
    4.  
    5. HEADERS += \
    6. dataplot.h
    7.  
    8. QWT_DIR = /qwt-521
    9. INCLUDEPATH += $$QWT_DIR/include
    10.  
    11. CONFIG(debug, debug|release):LIBS += -L$$QWT_DIR\lib\ \
    12. -lqwtd5
    13. else:LIBS += -L$$QWT_DIR\lib\ \
    14. -lqwt5
    15.  
    16. DEFINES += QWT_DLL
    To copy to clipboard, switch view to plain text mode 

    dataplot.h
    Qt Code:
    1. #ifndef DATAPLOT_H
    2. #define DATAPLOT_H
    3.  
    4. #include <qwt_plot.h>
    5. #include <qwt_plot_curve.h>
    6. #include <qwt_array.h>
    7. #include <qwt_math.h>
    8.  
    9.  
    10. class CurveData
    11. {
    12. public:
    13. CurveData( int size );
    14. const double *x() const;
    15. const double *y() const;
    16. QwtArray<double> d_x;
    17. QwtArray<double> d_y;
    18. };
    19.  
    20.  
    21. class DataPlot : public QwtPlot
    22. {
    23. public:
    24. DataPlot( QWidget* = NULL );
    25. QwtPlotCurve* curve;
    26. };
    27.  
    28.  
    29. #endif // DATAPLOT_H
    To copy to clipboard, switch view to plain text mode 

    dataplot.cpp
    Qt Code:
    1. #include "dataplot.h"
    2.  
    3.  
    4. CurveData::CurveData( int size )
    5. {
    6. d_x.resize( size );
    7. d_y.resize( size );
    8. // Initialize data
    9. for (int i = 0; i< size; i++)
    10. {
    11. d_x[i] = 0.5 * i; // time axis
    12. d_y[i] = 0;
    13. }
    14. }
    15.  
    16.  
    17. const double *CurveData::x() const
    18. {
    19. return d_x.data();
    20. }
    21.  
    22.  
    23. const double *CurveData::y() const
    24. {
    25. return d_y.data();
    26. }
    27.  
    28.  
    29. DataPlot::DataPlot( QWidget* parent ): QwtPlot( parent )
    30. {
    31. setAxisScale( yLeft , -1 , 1 );
    32. // Create curve
    33. curve = new QwtPlotCurve();
    34. curve->attach( this );
    35. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include <QMainWindow>
    3. #include "dataplot.h"
    4.  
    5.  
    6. const int PLOT_SIZE = 201;
    7.  
    8.  
    9. class MainWindow : public QMainWindow
    10. {
    11. public:
    12. MainWindow()
    13. {
    14. data = new CurveData( PLOT_SIZE );
    15. plot = new DataPlot;
    16. plot->setTitle( QString("Simple Qwt Usage") );
    17. plot->curve->setRawData( data->x() , data->y() , PLOT_SIZE );
    18. setCentralWidget( plot );
    19. startTimer( 20 );
    20. }
    21. private:
    22. DataPlot* plot;
    23. CurveData* data;
    24. virtual void timerEvent( QTimerEvent* e );
    25. };
    26.  
    27.  
    28. void MainWindow::timerEvent( QTimerEvent* )
    29. {
    30. static double phase = 0.0;
    31. for ( int i = PLOT_SIZE - 1; i > 0; i-- )
    32. data->d_y[i] = data->d_y[i-1];
    33. data->d_y[0] = sin( phase );
    34. plot->replot();
    35. phase += M_PI * 0.02;
    36. }
    37.  
    38.  
    39. int main(int argc, char *argv[])
    40. {
    41. QApplication a(argc, argv);
    42. MainWindow mw;
    43. mw.resize(500,300);
    44. mw.show();
    45. return a.exec();
    46. }
    To copy to clipboard, switch view to plain text mode 

    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?!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: First Project with Qwt - qwt_plot.h: No such file or directory

    Obviously you didn't install to /qwt-521. When you didn't change qwtconfig.pri manually Qwt should have been installed to /usr/local/qwt-5.2.1.

    Uwe

  3. #3
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: First Project with Qwt - qwt_plot.h: No such file or directory

    thanks, now it can found it but give another errors:

    Qt Code:
    1. Running build steps for project testeempty...
    2. Starting: "/usr/bin/make" clean -w
    3. make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    4. /usr/bin/qmake -spec /usr/share/qt4/mkspecs/linux-g++ CONFIG+=debug -o Makefile ../testeempty/testeempty.pro
    5. WARNING: /home/ze/Documentos/Qt/testeempty/testeempty.pro:13: Unescaped backslashes are deprecated.
    6. make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    7. make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    8. rm -f main.o dataplot.o
    9. rm -f *~ core *.core
    10. make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    11. The process "/usr/bin/make" exited normally.
    12. Configuration unchanged, skipping qmake step.
    13. Starting: "/usr/bin/make" -w
    14. make: Entering directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    15. 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/usr/local/qwt-5.2.1/include -I. -I../testeempty -I. -o main.o ../testeempty/main.cpp
    16. 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/usr/local/qwt-5.2.1/include -I. -I../testeempty -I. -o dataplot.o ../testeempty/dataplot.cpp
    17. g++ -o testeempty main.o dataplot.o -L/usr/lib -L/usr/local/qwt-5.2.1\lib\ -lqwtd5 -lQtGui -lQtCore -lpthread
    18. main.o: In function `MainWindow':
    19. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/main.cpp:16: undefined reference to `QwtPlot::setTitle(QString const&)'
    20. make: Leaving directory `/home/ze/Documentos/Qt/testeempty-build-desktop'
    21. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/main.cpp:17: undefined reference to `QwtPlotCurve::setRawData(double const*, double const*, int)'
    22. dataplot.o: In function `DataPlot':
    23. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:29: undefined reference to `QwtPlot::QwtPlot(QWidget*)'
    24. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:31: undefined reference to `QwtPlot::setAxisScale(int, double, double, double)'
    25. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:33: undefined reference to `QwtPlotCurve::QwtPlotCurve()'
    26. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:34: undefined reference to `QwtPlotItem::attach(QwtPlot*)'
    27. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:35: undefined reference to `QwtPlot::~QwtPlot()'
    28. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:29: undefined reference to `QwtPlot::QwtPlot(QWidget*)'
    29. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:31: undefined reference to `QwtPlot::setAxisScale(int, double, double, double)'
    30. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:33: undefined reference to `QwtPlotCurve::QwtPlotCurve()'
    31. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:34: undefined reference to `QwtPlotItem::attach(QwtPlot*)'
    32. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.cpp:35: undefined reference to `QwtPlot::~QwtPlot()'
    33. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x8): undefined reference to `QwtPlot::metaObject() const'
    34. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xc): undefined reference to `QwtPlot::qt_metacast(char const*)'
    35. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x10): undefined reference to `QwtPlot::qt_metacall(QMetaObject::Call, int, void**)'
    36. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x1c): undefined reference to `QwtPlot::event(QEvent*)'
    37. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x40): undefined reference to `QwtPlot::sizeHint() const'
    38. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x44): undefined reference to `QwtPlot::minimumSizeHint() const'
    39. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x84): undefined reference to `QwtPlot::resizeEvent(QResizeEvent*)'
    40. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xe0): undefined reference to `QwtPlot::print(QPainter*, QRect const&, QwtPlotPrintFilter const&) const'
    41. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xe4): undefined reference to `QwtPlot::canvasMap(int) const'
    42. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xe8): undefined reference to `QwtPlot::polish()'
    43. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xec): undefined reference to `QwtPlot::updateLayout()'
    44. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xf0): undefined reference to `QwtPlot::drawCanvas(QPainter*)'
    45. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xf4): undefined reference to `QwtPlot::clear()'
    46. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xf8): undefined reference to `QwtPlot::replot()'
    47. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0xfc): undefined reference to `QwtPlot::legendItemClicked()'
    48. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x100): undefined reference to `QwtPlot::legendItemChecked(bool)'
    49. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x104): undefined reference to `QwtPlot::drawItems(QPainter*, QRect const&, QwtScaleMap const*, QwtPlotPrintFilter const&) const'
    50. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x108): undefined reference to `QwtPlot::updateTabOrder()'
    51. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x10c): undefined reference to `QwtPlot::printLegendItem(QPainter*, QWidget const*, QRect const&) const'
    52. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x110): undefined reference to `QwtPlot::printTitle(QPainter*, QRect const&) const'
    53. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x114): undefined reference to `QwtPlot::printScale(QPainter*, int, int, int, int, QRect const&) const'
    54. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x118): undefined reference to `QwtPlot::printCanvas(QPainter*, QRect const&, QRect const&, QwtScaleMap const*, QwtPlotPrintFilter const&) const'
    55. dataplot.o:(.rodata._ZTV8DataPlot[vtable for DataPlot]+0x11c): undefined reference to `QwtPlot::printLegend(QPainter*, QRect const&) const'
    56. dataplot.o:(.rodata._ZTI8DataPlot[typeinfo for DataPlot]+0x8): undefined reference to `typeinfo for QwtPlot'
    57. dataplot.o: In function `~DataPlot':
    58. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.h:22: undefined reference to `QwtPlot::~QwtPlot()'
    59. /home/ze/Documentos/Qt/testeempty-build-desktop/../testeempty/dataplot.h:22: undefined reference to `QwtPlot::~QwtPlot()'
    60. collect2: ld returned 1 exit status
    61. make: *** [testeempty] Error 1
    62. The process "/usr/bin/make" exited with code %2.
    63. Error while building project testeempty (target: Desktop)
    64. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: First Project with Qwt - qwt_plot.h: No such file or directory

    I added this: LIBS += -L /usr/local/qwt-5.2.1/lib/ -lqwt and now it compile but when it go to execute it said:
    Starting /home/ze/Documentos/Qt/testeempty-build-desktop/testeempty...
    /home/ze/Documentos/Qt/testeempty-build-desktop/testeempty: error while loading shared libraries: libqwt.so.5: cannot open shared object file: No such file or directory
    /home/ze/Documentos/Qt/testeempty-build-desktop/testeempty exited with code 127
    so i need to open a console at /home/ze/Documentos/Qt/testeempty-build-desktop/ and run export LD_LIBRARY_PATH=/usr/local/qwt-5.2.1/lib/ and after if i run ./testeempty it works

    What i need to add to my qt project file to avoid to do this: export LD_LIBRARY_PATH=/usr/local/qwt-5.2.1/lib/ !?

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: First Project with Qwt - qwt_plot.h: No such file or directory

    Nothing instead you have to understand how shared libraries work. F.e. read about ldconfig.

    Uwe

  6. #6
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: First Project with Qwt - qwt_plot.h: No such file or directory

    Bu i don't want to need to add the path to ldconfig instead this is the last option. What i want is to have all the files,libraries in the same folder, and can change the folder between pcs without need to add the path to ldconfig!

Similar Threads

  1. Copy a Qt project to another directory
    By QtFan19 in forum Qt Programming
    Replies: 6
    Last Post: 30th December 2009, 08:22
  2. change makefile directory from qt project file
    By majer627 in forum Qt Programming
    Replies: 0
    Last Post: 22nd December 2009, 08:28
  3. Replies: 1
    Last Post: 3rd December 2009, 23:34
  4. Replies: 7
    Last Post: 2nd November 2009, 19:07
  5. Default Project Directory
    By MIH1406 in forum Newbie
    Replies: 8
    Last Post: 8th September 2009, 08:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.