PDA

View Full Version : Add Qwt 5.2.2 to Qt Creator project in Windows 7



Momergil
9th November 2011, 19:06
Hello!

I'm trying now to compile in Windows a software I created in Linux that uses Qwt. In Linux, everything that I had to do to use qwt was to download it in the Synaptic and add to the .pro file:


LIBS += -L/usr/local/lib -lqwt-qt4
LIBS += -L/usr/local/lib -lQtSvg

and in the header where I create the Qwt objects:


#include <qwt-qt4/qwt_plot.h>
#include <qwt-qt4/qwt_plot_curve.h>
#include <qwt-qt4/qwt_plot_grid.h>
#include <qwt-qt4/qwt_plot_canvas.h>

Now that I'm in Windows, though, I simply don't know what to do. I searched a lot of guides in the net and none of the worked. I now essentially that I had to compile the qwt having changed the qwtconfig.pri before (as http://johnhforrest.com/2010/09/installing-qwt-on-windows/ indicated) and now I need to add qwt as an external library in the .pro file.

But I simply don't know the code to add; everything I try leads to the same error: the headers are not found. All things I tried:


include(C:\QtSDK\qwt-5.2.2\qwtconfig.pri)
LIBS += -L/C:/QtSDK/qwt-5.2.2/ -lqwt-qt4
LIBS += -LC:\QtSDK\qwt-5.2.2\lib -lqwt5.dll
LIBS += -LC:\QtSDK\qwt-5.2.2 -lQtSvg
INCLUDEPATH += C:\QtSDK\qwt-5.2.2\include

LIBS += C:\QtSDK\qwt-5.2.2\lib\qwt5d.dll
LIBS += -LC:\QtSDK\qwt-5.2.2 -lqwt

Note: not all of them together.

... but none worked. So what need I to do?

One interesting thing that I noticed was the the compile of qwt before adding it to the project did not create any .lib file, and the .dll files sims useless.


Could somebody help, please?

Thanks!

Momergil

Spitfire
14th November 2011, 10:18
Compiler can't find your headers because it searches for them in <INCLUDEPATH>/qwt-qt4 directory which doesn't exist (also qwt-5.2.2\include doesn't exists either unless you've changed something).

In your *.pro file add:
win32:INCLUDEPATH += C:\QtSDK\qwt-5.2.2and rename the src directory inside C:\QtSDK\qwt-5.2.2 to qwt-qt4, then compiler should be able to find header files.
This way you won't have to modify your source files and it should compile on linux as well as on windows.

You'll also need an os specific library statements in the pro file, something like that:
win32 {
LIBS += -LC:\QtSDK\qwt-5.2.2\lib -lqwt5 (that's release version qwtd5 is debug)
}
unix {
LIBS += -L/usr/local/lib -lqwt-qt4
LIBS += -L/usr/local/lib -lQtSvg
} you should also add per os release/debug handling in the pro file.

Your final *.pro file should have something like that:

win32 {
INCLUDEPATH += C:\QtSDK\qwt-5.2.2

CONFIG(debug, debug|release) {
LIBS += -LC:\QtSDK\lib -lqwtd5
}
else {
LIBS += -LC:\QtSDK\lib -lqwt5
}
}

unix {
LIBS += -L/usr/local/lib -lqwt-qt4
LIBS += -L/usr/local/lib -lQtSvg
}
and remember to rename qwt's src directory to avoid messing with your source files.

Oleg
15th November 2011, 10:09
Installing Qwt with "make install" brings qmake configuration file to your system (see end of INSTALL file from Qwt). So, you can simply do such magic in your project file:


CONFIG += qwt


It's useful when you build project in different environments.

Uwe
15th November 2011, 10:42
So, you can simply do such magic in your project file:


CONFIG += qwt
For Qwt 6.x - but not for Qwt 5.x !

Uwe