the choice of toolset
now I have been developing software on Linux with its great variety of
excellent opensource software development tools. When at last I came to
an application for
a real purpose, it was important to run it on Windows and
to use a GUI that was rich in features. This application was to be an
extension to a commercial Church Membership database that was developed
in the Microsoft Access environment. As with most closed source
software, it lacked
adequate configurability for our needs. We extended it gradually with
add-ons written within the Access environment, but quickly
discovered Access's limitations. I wanted to do some real
development using a modern object-oriented language, and balked at the
necessity to learn Visual Basic and to remain tied into Access. Finding
a good language, IDE and GUI framework for both platforms
has been a somewhat difficult process.
The three main GUI frameworks available for multiple platforms are GTK+, WxWidgets and
trying out the first two, I felt I could not go past QT. It
is very complex but very well documented and provides an immensely
rich set of C++ classes for all sorts of tasks.
QT4 is a significant upgrade from QT3, involving a large number of
naming changes and concept changes. This meant a significant rewrite of
QT3 applications. The IDE provided with QT3 has been dropped and QT4 is
designed instead to be integrated into other existing IDEs. Other
occurred in moving to QT4.2, so the framework appears to be a moveable
feast. A big plus for QT4 is that it has been made opensource on
Windows and Macintosh as well as Linux. QT5 is a smaller but
significant upgrade of QT4 and requires a small number of changes to
and WxWidgets are simple to use and great for
rapid development work. I feel that they do not have the richness of QT
for larger projects where greater control over the GUI is desired. This
may be a little unjust as I didn't go deeply into them, but I believe
that they are excellent frameworks for Rapid Application Development of
smaller projects or those that
have only basic requirements for the GUI.
first thought was to
use Python; after all someone will have to take over after me. In the
end the need to install a runtime environment and Python-C++
wrappers, as well as facing potential performance hits with an
interpreted language, led me to fall back on QT's natural
language C++. The complexity of the application would be mainly in the
QT implementations. Though C++ is a bit heavyweight and showing signs
of excessive modification over the years, it is still of excellent
a modern OO language. I also feel more comfortable with the strict
typing that it enforces.
I used QT3 and KDevelop on Linux quite happily for some
These work reasonably well together. To use QT on Windows with some
sort of C++ IDE, I drifted naturally
to the MinGW port of gnu gcc, and the Dev-C++ IDE provided
opensource by Bloodshed Software. Dev-C++ is a basic
IDE, easy to learn and use, but appears
unfinished, and development appears to have stalled for over 18 months
as of this writing. It has an
integrated code editor, class browser, and convenience buttons to
compile and run the application. I was not able to get the integrated
debugger to work most likely because I hadn't built QT on Windows with
support enabled (see below). It also has some
other annoying quirks that are bound to build your character. QT is not
integrated with it in any way. While it seems possible to make it work
a bit better than I could, the amount of effort required could be
better expended on a more advanced IDE.
but not opensource Windows IDE is Microsoft's
Visual Studio Express. This appears to require extensive work: patching
compiling of QT. You can find information at Quantum
GIS (slightly outdated) and PsiWiki.
This would have required me to drift too far into the Windows universe
so I didn't try it out.
is based on Java and is available for both Windows and Linux. It has a
bit of a steep learning curve and can be slow loading and running, but
a large user
base and is growing continuously. This appears by far to be the best
IDE available and is well worth the effort to learn how to use it. It
works on the basis of a framework written in Java, coupled with plugins
to support various languages and environments. The primary language
support is for
Java, but there are plugins to support development in Python and C/C++
others. As well as some QT support in Eclipse, there are a couple of
plugins to integrate QT into the
framework: an embryonic offering http://artis.imag.fr/~Xavier.Decoret/resources/qt/eclipse/,
Eclipse plugin for KDE (which is based on QT): http://kde-eclipse.pwsp.net/.
QIde is an IDE built for
making more effective use of QT.
Installation and Configuration on Windows
This is for QT4. A similar approach would be needed for QT5. To begin, download
- MinGW from Sourceforge MinGW.
It can also be downloaded during the QT4 install process. This may be
preferable to ensure that QT4 has the correct version of MinGW. The
installer does not add a path
variable pointing to the MinGW bin directory. Make sure that you add
this (Windows XP: Control Panel/System/Advanced/ Environment
Variables, and edit your personal path or system path). I put it in
D:\Development\MinGW. There is another package called MinGW-utilities
that you may find useful. Install this and any other MinGW packages
over the MinGW installation root directory.
- MSYS from Sourceforge MinGW.
This provides a Unix shell environment for building native Windows
applications. Install this in a separate directory, but make sure you
have already installed MinGW. A post-install procedure requires you to
locate the latter to ensure good integration of the two.
- QT4 from Trolltech
The QT/Windows Open Source LGPL Edition, current version at this time is
should get theDevelopment libraries for Windows, which is the version for MinGW (in my case it
was qt-win-opensource-4.5.1-mingw.exe). This installs easily enough and
a path variable is added automatically. I put it in D:\Development\QT4.
The binary package for QT does not
appear to include any debug libraries so it should be built from source
to include these and any other plugins you need.
- A few other useful utilities:
- Dependency Walker
from here that shows
what each application depends on.
from here. A basic but
It is best to build
QT from source to obtain the benefits of various debug features. You
will also need to build QT statically if you intend to statically
compile applications with QT. Note that many developers recommend
against this practice with fanatical vigour, but some people consider
simpler to work with on Windows as only one (bulky) executable needs to
distributed. You may also need to add other types of support such as
for SQL drivers. Read the various configure options carefully.
QT's deployment advice
tells us that we just need to run configure
-debug-and-release from a command line, followed by mingw32-make The process can take
hours. For static build use configure
-debug-and-release -static. If you just want to build
the basic libraries and binaries and are not interested in the examples
etc, then use mingw32-make sub-src
(which builds only the source). There is additional advice at qtnode.
- Download the package for your platform and make sure that
the Java environment is installed. This should be provided with more
recent Windows and Linux versions.
- On Linux I simply untarred it to a directory in my home
directory, although it is possible as root to make it more globally
accessible. Most distributions should have an install package for it
(Fedora maintains a compiled Java version that does not need the Java
environment and is a bit faster). For Windows again it can just be
unzipped to a local
directory. No installation is needed. The version at this time is
- Start up the Eclipse executable. You are asked to nominate
your workspace which I set as D:\Development. Projects will be formed
in subdirectories of this workspace root.
- To get the C/C++ plugin, go to Help->Software
Updates->Find and Install.
Select "Search for New Features to Install" and click "New Remote
Site". There you can add the URLs for sites with the C/C++ plugins CDT (http://download.eclipse.org/tools/cdt/releases/callisto),
or Python Development PyDev (http://pydev.sf.net/updates/).
Click finish and follow the prompts through. The plugins are found and
you are invited to select the ones you want. Just select all of them
and get it over with. These sites are arranged so that Eclipse
downloads the plugins for you, but if you have many machines to setup,
you can just download the packages and untar them so that the jar files
end up in the plugins directory. For some plugins this is the only way
to do it. When Eclipse is restarted they will be found and used.
- Now go to Window->Preferences. Here the fun starts as
most of the options will require some reading and experience to be
Go to Window->Open Perspective->Other... You can
select C/C++ to place the IDE into a state that is oriented better for
the development of C/C++ projects.
Go to Window->Views->Navigator. This is very
convenient for finding and loading files to be edited. The other views
could be closed until needed to leave more room on the screen for the
- Expand the entry "General" and select Workspace. The top
three checkboxes can be ticked; the third one saves files when a build
is initiated, which is convenient.
- If CDT is installed, you will see a C/C++ entry. Expand
this entry and the entry for Make. Select "New Make
Projects". I selected "Build on Resource Save". You should remove the
"all" make option in both option boxes if you haven't built QT to
include debugging. Uncheck the top checkbox "Use Default" and enter the
FULL PATH to the
MinGW executable mingw32-make
rather than the default make.
If you get errors saying that Eclipse is unable to launch make, this is
most likely the reason. You can also change this under
Project Preferences for individual projects.
the feature called "code completion" in the Eclipse editor. This can
cause Eclipse to apparently hang. What happens is that when you type a
character such as ".", "->" or "::" the editor will search for a
class to match, and present a selection of valid classes and members.
In Window->Preferences->C/C++->Editor->Content Assist, you
will see radio buttons at the top which may offer to perform the search
through all included files. This can save a lot
of manual searching for an appropriate member function, but if you have a large
number of classes, as a QT application may have, the search can take a
Creating a new project is simple enough. Go to
File->New->Project and select the project type you want. Enter
the project name and click "Next" (not "Finish"). You then get a range
of options. Just check the Make tab to ensure that the default settings
made above have been selected. I have only used the Standard Make C/C++
project, which assumes a Makefile is provided. This is provided by
qmake in my case,
which I run from the command line outside Eclipse. It
is likely that Eclipse
could be coaxed to run qmake
automatically before a build as there are
utilities to create special builds. The Managed Make projects will have
their Makefile created automatically by Eclipse.
If you already have a project underway, copy it into a
directory in your workspace and again go to File->New->Project.
Give it the same name as the directory. It should then appear in the
navigator panel (left side of screen) with all the files in the
directory organised according to their purposes. I found that unless
Eclipse had been used on this project before,
I had to build the project before Eclipse sorted things out.
Build the project by choosing Project->Clean in case
there are old object files etc around. You can select if you want it to
rebuild immediately afterwards. To run the project select
Run->Run... and enter the location of the executable. On Windows
this will be under the release or debug subdirectory depending on which
one you want to run. Make sure that the project name is correct. After
that has been configured,
you can build and run by clicking an icon on the Toolbar. There is a
"build all" icon also.
On Windows, make sure the paths are defined (use a command
type path to see the path
settings) that point to the QT and MinGW bin directories. The latter
does not seem to be set on install so you need to add it manually. You
will need to set the QT one if you build from source.
people have found difficulties with using Dev-C++ with QT. Dev-C++ needs some
pampering to work effectively with QT. Here are the
steps I took to get it going:
- Dev-Cpp from Sourceforge DevCpp.
The latest version, currently 18.104.22.168 beta, is over 18 months old. The
installs easily. I put it in D:\Development\DevCpp (I like my root
- Decide on a directory to use for your code. In my case I
used D:\Development\ChurchRoll. In there place all your source code
files and the QT .ui files. You can play around with a better
organization but I recommend this simple flat structure to start off.
- Use QT to create a simple window example called MainWindow,
and save it in the D:\Development\ChurchRoll directory. You should have
a file MainWindow.ui, which is an XML file containing all information
about the window and anything you put on it.
- Now open up Dev-C++. Create a new project of type "Windows
Application", and save the .dev file with an appropriate name in the
- You can now create the .cpp and .h files for the QT example
you have created. This is heaps of fun but give yourself plenty of time
to learn QT and C++. You only need some basic do-nothing files to start
with, check out some of the examples provided with QT.
- When the source and header files are ready, open a DOS
Command window and navigate to the D:\Development\ChurchRoll directory.
Then type "qmake -project" to create a QT project file. This
searches through the directory and all subdirectories under
D:\Development\ChurchRoll to find any .h, .cpp and .ui files. You
can put code in subdirectories if you like provided you run this
command in the
top directory. You really only need to do this once, but you can do it
whenever new files are added if you don't want to edit the .pro file
yourself. The .pro files are very simple in structure, and only need to
have any new files added to the appropriate lines. If qmake can't be
found, then the path is probably wrong.
- Then run "qmake". This creates a Makefile for compilation
of the entire project. This needs to be done whenever the .pro file is
- Unlike the Linux version, three Makefiles are created:
Makefile, Makefile.release and Makefile.debug.
- To compile you should be able to run the command "make" or
"mingw32-make" to compile the project. This uses Makefile.release.
Makefile.debug will have difficulties if you have not compiled QT for
- To compile in Dev-Cpp you need to make the following
settings in Project/Project Options:
Note that I abandoned Dev-C++ before I got around to
checking out the debug features.
- Under "General" make sure it is a Win32 GUI type.
- Under "Directories" add the QT lib directory and the QT
include directory under the appropriate tabs.
- If in "Build Options" you add the
directory as the executable output directory,
you can then use Dev-C++ buttons to run the application. This directory
is where the source code ends up. I find this very convenient, however
Dev-C++ seems to try to create this directory and throws up error
messages on startup.
- Finally under "Makefile", make sure that you have changed
the makefile to use the custom Makefile.release. The default is
Makefile.win, and if it does't exist, Dev-C++ will create one which
nothing about QT. If you get linker errors, always check first that the
checkbox on this screen is ticked. It seems to turn itself off at odd
times after any options are changed.
Many thanks to Trolltech for releasing this very powerful GUI
development tool, and to Microsoft for releasing Visual Studio. Also to
the developers of Dev-C++, Eclipse, CDT and MinGW and other utilities
and packages mentioned here. All of these efforts
appreciated as are those of all opensource developers.