Download and unzip the tinyxml in the project folder of the Qt application. cd to the Qt project folder and enter the following command in the command prompt:
$qmake -project
This will generate the xxx.pro (where xxx refers to the name of the Qt project folder), in the xxx.pro insert the following lines below the line starting with "TARGET = ":
DEPENDPATH += . tinyxml
INCLUDEPATH += . tinyxml
Showing posts with label Qt. Show all posts
Showing posts with label Qt. Show all posts
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
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
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
Step-by-step for installing Qt on Ubuntu Linux
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
Sunday, January 9, 2011
Delete a folder in Qt
This code snippet allows programmer to delete a folder in Qt
#include <QDir>
void deleteDir(const std::string& foldername)
{
#include <QDir>
void deleteDir(const std::string& foldername)
{
QDir dir;
dir.rmdir(foldername.c_str());
}
List directories in Qt
This code snippet allows programmer to list directories in a parent directory "C:\temp" by using Qt API
#include <QDir>
void list(QStringList& dirnames)
{
QDir currentDir("C:\\temp");
currentDir.setFilter(QDir::Dirs);
QStringList entries = currentDir.entryList();
for( QStringList::ConstIterator entry=entries.begin(); entry!=entries.end(); ++entry )
{
//std::cout << *entry << std::endl;
QString dirname=*entry;
if(dirname != tr(".") && dirname != tr(".."))
{
dirnames.add(dirname);
}
}
}
#include <QDir>
void list(QStringList& dirnames)
{
QDir currentDir("C:\\temp");
currentDir.setFilter(QDir::Dirs);
QStringList entries = currentDir.entryList();
for( QStringList::ConstIterator entry=entries.begin(); entry!=entries.end(); ++entry )
{
//std::cout << *entry << std::endl;
QString dirname=*entry;
if(dirname != tr(".") && dirname != tr(".."))
{
dirnames.add(dirname);
}
}
}
Monday, January 3, 2011
The procedure entry point _Z5qFreePv could not be located in the dynamic link library qtCore4.dll
To remove the issues with release build issue error "The procedure entry point _Z5qFreePv could not be located in the dynamic link library qtCore4.dll":
- Track down the source of the dll using depends.exe (downloadable from http://www.dependencywalker.com/)
- Source of Problem 1: debug version of an app exe compiled and opened fine, release version of same app would compile fine but exe failed due to "entry point" in dll failure. There are some old QtCore and QtGui dll's in System32 directory.
- Solution 1: The release version was referencing these dll's. I removed them.
- Source of Problem 2: the QtCore.dll referenced is pointed to "C:\Qt\2009.02\bin" instead of "C:\Qt\2009.02\qt\bin"
- Solution 2: remove "C:\Qt\2009.02\bin" from the path environmental variables
Totally remove Symbian SDK for Qt to use its make
The "make" error is quite annoying when you previously install Symbian SDK and now want to use Qt for build as the make tool will be set to that of Symbian SDK instead of the Qt make. To remove the problem of "make" with the previous installation of symbian SDK:
- go to the global environmental variables
- go to the system variables, remove "C:\Program Files\Common Files\Symbians\Tools\..." from the "Path" variable
Print to console in Qt
To print to console in Qt
- write the code the usual console output way, e.g. "std::cout << ...", Note that any QString object must be quoted inside "qPrintable" function, e.g. "std::cout << qPrintable(QString("hello")) << .."
- enter "qmake -project"
- add "CONFIG += console" to the xxx.pro file
- enter "qmake"
- enter "make"
Sqlite in Qt
To connect to the Sqlite database in Qt
- add "#include "
- add "QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE")" in the code body
- enter "qmake -project"
- add "QT += sql" in the xxx.pro file
- enter "qmake"
- enter "make"
Subscribe to:
Posts (Atom)