May 9, 2012

Sam Sam
Area 51 Engineer
609 posts

[SOLVED] QWT 6.0 library in QT

 

Hi,
I have downloaded QWT 6.0 from svn co https://qwt.svn.sourceforge.net/svnroot/qwt/branches/qwt-6.0 [qwt.sourceforge.net] . I am able to run the sample example that are provide within the same folder.
But I need to use the same library for my projects. So i created a new project and copied the program tvplot from the qwt examples.

I then added the following code in my .pro file

  1. INCLUDEPATH += D:\Qwt\include
  2. DEPENDPATH += D:\Qwt\lib
  3.  
  4. LIBS += -LD:\Qwt\lib
  5.  
  6. win32 {
  7.  CONFIG(debug, debug|release) {
  8.                 LIBS += -lqwtd
  9.  } else {
  10.                 LIBS += -lqwt
  11.  }
  12. }

But when i compile and run it gives error “cannot open include file qmemarray.h” . I have searched on the net for the header files as well as how to setup qwt libraries. But didnt get this working on windows 7.

Thanks for your time :)

8 replies

May 9, 2012

Andre Andre
Area 51 Engineer
6031 posts

QMemArray is a Qt3 relic. QVector would be the closest Qt4 equivalent. I have no idea why QWT tries to use it still… However, a quick search on “QMemArray Qwt” gives quite a number of hits. Perhaps your answer is among them?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

May 9, 2012

Sam Sam
Area 51 Engineer
609 posts

Hi,
Thanks for the reply Andre. I searched for “QMemArray Qwt” and have gone through all the links and solution in the first page. However I tried a different approach. I created a new Project in the same path where i have copied qwt e.g c:\qwt-6.0\examples. And then in the .pro file of my project i included

  1. include( $${PWD}/../examples.pri )

Which is specified in all the .pro file in the example folder of QWT.

It work and display the mainwindow with the charts. But if i create a folder in any other directory and then write

  1. LOCATION = C:\qwt-6.0\examples
  2.  
  3. include( $${LOCATION}/examples.pri )

It includes the files but shows the same error cannot include qmemarray.h

May 9, 2012

koahnig koahnig
Mad Scientist
2099 posts

Soumitra, did you find a reference to qmemarray.h in the source for QWT? I have QWT 6.0.1 source and I could not find a reference to this header file within the whole source tree.
Possibly the problem is triggered by something else.

May 9, 2012

Sam Sam
Area 51 Engineer
609 posts

Hi Koahnig,

I couldnt find any reference to qmemarray.h . I searched for the file in the source folder but couldnt find one . When i click on the compiler error it opens qwt_array.h

  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2.  * Qwt Widget Library
  3.  * Copyright (C) 1997   Josef Wilgen
  4.  * Copyright (C) 2002   Uwe Rathmann
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the Qwt License, Version 1.0
  8.  *****************************************************************************/
  9.  
  10. // vim: expandtab
  11.  
  12. #ifndef QWT_ARRAY_H
  13. #define QWT_ARRAY_H
  14.  
  15. #include "qwt_global.h"
  16.  
  17. /*!
  18.   \def QwtArray
  19.   Aliases QArray (Qt-2.x) and QMemArray (Qt-3.x) to QwtArray
  20.  */
  21. #ifdef QWT_NO_MEMARRAY
  22. #include <qarray.h>
  23. #define QwtArray QArray
  24. #else
  25. #include <qmemarray.h>    <---Here this file is included.
  26. #define QwtArray QMemArray
  27. #endif
  28. #endif

And even if i add qmemarray.h (source code from google search) Then the error changes to some other header file missing.

May 9, 2012

koahnig koahnig
Mad Scientist
2099 posts

In which folder do you have qwt_array.h ?
I do not find this in my source tree?

May 9, 2012

Sam Sam
Area 51 Engineer
609 posts

Hi koahnig,
Sorry I was linking to the old library which i downloaded from qwt [sourceforge.net]. I switched the path to the current source library

  1. INCLUDEPATH += C:\qwt-6.0\src
  2. DEPENDPATH += C:\qwt-6.0\lib
  3.  
  4. LIBS += -LC:\qwt-6.0\lib

This works now for my project created in some other path. But I have written

  1. LOCATION = C:\qwt-6.0\examples
  2.  
  3. include( $${LOCATION}/examples.pri )

in my .pro which refers to the .pri file in qwt-6.0 source folder. This is working. Is this the right approach ?

May 9, 2012

koahnig koahnig
Mad Scientist
2099 posts

If it compiles and you see no other issues, I would assume that it is correct. I am using QWT with MSVC and the include path is simply directed to src folder.
I am rarely using .pro and .pri files under windows.

May 9, 2012

Sam Sam
Area 51 Engineer
609 posts

Thanks for the help. As of now this is working but if there is any problem i’ll come back again :)
I also need to implement the QwtPlot3D library too. I’ll discuss that in other thread.

Thanks for your time :)

 
  ‹‹ Trouble building QtMock in visual studio, linking errors      MYSQL Installation on Mac OS X ››

You must log in to post a reply. Not a member yet? Register here!