pBook‎ > ‎Plot C++‎ > ‎

Installing Qwt

posted Sep 21, 2014, 7:32 AM by Javad Taghia   [ updated Sep 22, 2014, 6:36 PM ]

1. you need to have QT installed on your VS.

2. Installing Qwt on Windows (http://johnhforrest.com/2010/09/installing-qwt-on-windows/)

by  • September 17, 2010 • GuideProgramming • 22 Comments

I am writing this guide as a follow up to my Qt installation guide. Qwt is a graphics library built specifically for the Qt framework. I use it in my ReplayParser application to draw the APM chart, and it definitely saved a lot of time in that area of development. I haven’t had any problems in terms of the functionality of the library, but as many of the sourceforge users point out, the documentation is weak at best. So, I’ve decided to write a quick installation guide for those who are interested in utilizing this graphics library.

This guide assumes that you have installed the latest version of Qt using my previous guide as well as Visual Studio 2008. As always, please feel free to comment if any of the instructions are misleading or I have left anything out in the guide.

1. Download the latest build from the Qwt project page: http://sourceforge.net/projects/qwt/ (the current version is 5.2.1)

2. Unzip the file, and extract the contents to a folder of your choosing. I chose to place mine in C:\Qt\Qwt-5.2.1.

3. Update the configuration file, qwtconfig.pri. This is probably one of the most important steps, but also one of the least obvious ones. It took me several hours of digging online to figure out what exactly to edit for my particular configuration.

The main things to edit here are:

INSTALLBASE - make sure this path matches where you have placed the extracted folder (again, I chose mine to be C:\Qt\Qwt-5.2.1).

DEBUG/RELEASE CONFIG - the comment in the .pri file point out that you can’t mix the release and debug libraries, so I recommend building both. To do this, uncomment the debug_and_release and build_all fields, as well as commenting out the release field (this is done with a # symbol).

STATIC CONFIG – if you have built Qt statically as outlined in my previous guide, be sure to comment out the QwtDll option, otherwise you will have to distribute the .dll file with your application.

Those should be the only settings you need to change. I have uploaded my configuration file, qwtconfig.pri, as a reference for this step (I had to upload it as a .txt file, simply change the extension if you want to download it and use it directly).

4. Start the Visual Studio 2008 Command Prompt

  1. On the Start screen, type Visual Studio, and then choose Visual Studio Tools. (To access the Start screen, press the Windows logo key Windows logo on your keyboard.)

  2. In File Explorer, choose Developer Command Prompt for VS20xx

. Navigate to C:\Qt\Qwt-5.2.1\, and run the following command:

qmake

After a few seconds the qmake operation will complete (no prompt or notification will be given upon completion), and you can build the library with this command:

nmake

This will take some time, but afterwards the library will be completely built and ready for use.

5. In order to incorporate the Qwt library into your Visual Studio projects, a few last configuration steps need to be made. To do this, open up Visual Studio 2008 and click on Tools -> Options -> VC++ Directories.

Similar to the Qt configuration, there will be several paths to add. Starting with the Include Files, add your path equivalent to: C:\Qt\Qwt-5.2.1\src. Qwt is different in that it doesn’t create its own include folder, so we must instead path to its src folder as shown before. This same path will be used in Visual Studio’s Source Files for Intellisense detection. Lastly for the Library Files, add your path equivalent to C:\Qt\Qwt-5.2.1\lib. After doing all of these, close Visual Studio.

6. Re-open Visual Studio (the closing and then re-opening is important to refresh the IDE’s settings). If you have a project that you would like to use Qwt in, you must link the Qwt libraries to the project.

To do this, open your project up, right-click on the project name in the solution explorer, and click on Properties. This will open up a dialog box with several configuration options. Path to Configuration Properties -> Linker -> Input. In the Input tab, the top field should be called Additional Dependencies. Assuming you have already done the steps of creating a Qt project, all of the associated Qt library dependencies should be here. Simply add these dependencies to the end of the list:

qwtd.lib (for the debug mode) and

qwt.lib (for the release mode)

Be sure to only add one for each mode of your project.

7. Theoretically, that should complete the installation and configuration. However, in my experience there always seem to be a few technical issues here and there, so if this guide doesn’t work 100% for you, post a comment below and I will try and help debug what is going wrong. I highly recommend also exploring the examples that come with the Qwt download, as the online documentation can be very frustrating to go through.

3. Now you can open in QT the project from the examples and run it.

ċ
qwt-5.2.1.zip
(2593k)
Javad Taghia,
Sep 21, 2014, 7:32 AM
ċ
qwtconfig.txt
(4k)
Javad Taghia,
Sep 21, 2014, 7:32 AM
Comments