Tuesday, July 9, 2013

Step-by-step for installing QwtPlot on Ubuntu Linux

Step 1: Install g++
Check whether g++ compiler has been installed on the target Linux machine by entering the following in the command prompt:
$g++

If the target Linux machine indicates no g++ compiler is installed on the machine, proceed to install the compiler by entering the following in the command prompt:
$sudo apt-get install g++

Step 2: Install CMake
Check whether cmake has been installed on the target linux machine, by entering the following in the command prompt:
$cmake -help

If the target linux machine indicates no cmake is installed on the machine, proceed to install cmake by entering the following in the command prompt:
$sudo apt-get install cmake


Step 3: Install Qt
Check whether Qt has been installed on the target linux machine, by entering the following in the command prompt:
$qmake -help

If the target linux machine indicates no Qt is installed on the machine, proceed to install Qt by entering the following in the command prompt:
$sudo apt-get install libqt4-dev qt4-dev-tools

Step 4: Install QwtPlot
To install QwtPlot, download the software package qwt-6.0.1.zip from 

Unzip the package (to unzip, if you are using Ubuntu, right-click the zip file and click "Extract Here" from the context menu). Next from the terminal, cd to the unzipped folder "qwt-6.0.1", and run the following command:
$qmake
This will generate the Makefile require to build QwtPlot, next run the command:
$make
This will build the QwtPlot, next run the command:
$sudo make install
This will install QwtPlot (when using ubuntu, the installed directory can be found at usr/local/qwt-6.0.1). The final step is to add the QwtPlot export statement into the .bashrc file in the /home/[username] directory ([username] refers to the linux login id). To add the export statement, run the following commands in the terminal:
$cd /home/[username]
$ls -a
$gedit .bashrc
In the .bashrc file that opened, add the following two lines to the bottom of the file
export QWT=/usr/local/qwt-6.0.1
export LD_LIBRARY_PATH=$QWT/lib:$LD_LIBRARY_PATH

Step 5: Build Qt application using QwtPlot
To build the Qt application with QwtPlot data visualization, enter the following command with the  Qt project folder:
$qmake -project

This will build the xxx.pro (where xxx refers to the project name), in the xxx.pro, just below the line starting wtih "INCLUDEPATH" (or below the line starting with "TARGET=" if line starting with "INCLUDEPATH"  is not in xxx.pro), insert the following lines:
QWT_VER_MAJ      = 6
QWT_VER_MIN      = 0
QWT_VER_PAT      = 1
QWT_VERSION      = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT}

QWT_DIR = /usr/local/qwt-$$QWT_VERSION 

LIBS += -L$$QWT_DIR/lib -lqwt
INCLUDEPATH += $$QWT_DIR/include

Now run the following command to build the project
$qmake
$make


No comments:

Post a Comment