Why to use GTK+ v2.8+ and Cairo v1.4+ to develop GUI crossplatform applications

[italian version (older - meno aggiornata)]
My first programming language was BASIC, the unique available for Sinclair ZX Spectrum. Then I started studying the Assembler Z80.
When I switched to PC, I discovered the GwBasic and then the QuickBasic. In each of this different dialects, the graphic was very different, but always present.
I have been learning programming in C language for many years, at the beginning for hobby, then at school, applying only to algorithmic functions, mostly because the C standard libraries miss graphical functions, and also miss functions for windows and widgets. Recently I promoted a petition for this.
When Microsoft presented Windows, already with version 1.0, and the 3.1, the QBasic programs used to run in a DOS Box, so I did not bothered about that. I was a C beginner, and I did not care about the lack of graphics capabilities. C was developed for system programming, where performance is needed, and graphics is the opposite, always the slow part.
When Windows 95 and WinNT4 were available, and later Linux, I abandoned completely Basic, focusing on C for power, performances, and for memory constraint of QuickBasic that worked in "real mode" under DOS. Immediately later I started to appreciating the best, unique feature of C: the portability across all architectures, operative system and microprocessor (x86, ppc, sparc, alpha, ...) independency. I remember that at that time I bought a VisualBasic3 student license, but I never installed it.
Working on DOS and WinNT4, I always used the 'djgpp' compiler, a gcc port for MS-DOS. On Linux gcc is embedded, so, for work reasons, gcc became my preferred compiler also on other OS, like HP-UX, Solaris, OSF, VxWorks, etc... but always for the algorithmic and CLI part, I never dealt with GUI, as I used to develop drivers for VxWorks and Linux in telecommunication environment.
In recent years, on Windows 2000/XP, I have always used the Cygwin port of gcc, that is bundled with a complete GNU Posix emulation environment on Win32 platform that natively misses it.
Around 2005 I started to need using graphics, especially for math functions, or simple draws in C language.
Since I was used to compile all of my C applications on any platform, to me seems too restrictive to learn something which is mono platform.
I found many graphic libraries, to draw points, lines, mathematical graphs, but for Unix systems only, otherwise the Microsoft GDI (used by VisualBasic and VisualC) but for Win32 only.
I was looking for a crossplatform C library for drawing, and to develop basic GUI widgets. So I started searching the available solutions. Of course I excluded the GDI and DirectX, since they work on Win32 only. If I learned them, I would have a bad tool, suitable to one platform only, useless for my work, and, should Windows disappear in the future, useless for my personal knowledge too.
In the Unix world two mature solutions exist: KDE based on QT library developed by Trolltech, and GNOME based on GTK developed by the GNU community. Of both exist the Win32 and MacOS port, but QT requires to release the source of the developed application or to buy a license for closed source release. Another valid solution is WxWidgets, in open source license on all platforms. I tried to understand which one was the best for me, which one had best probability to survive and spread, which one was better.
Looking around I founded that there are many more big notable crossplatform projects (Mozilla, Gimp, Wireshark/Ethereal, Pidgin/Gaim, Evolution, Inkscape, VMware server, ...) written using GTK+, rather then using the other two libraries, probably because GNOME is developed by the GNU community, which consists of many developers, participants to project management and strategic decisions. Moreover GTK is C language native, while the other two libraries are for C++ that I know less. So I started studying the GTK tutorial. After having learned the basis, I needed to try to compile something. A that time on my home PC I used to run mainly Windows, and only occasionally Linux, especially when I needed to write code, because of the better support to developers. Cygwin was very useful, adding missing Win32 features. Cygwin is packaged with GTK, so it is easy to try something. For the first windows tutorial everything worked. With some more complex applications, developed with the GUI rapid developer Glade everything worked again, but, again, for my drawing need for points, line, and mathematical graphs, I had to use the GTK base functions, the GDK.
At that time, the most recent GTK version was 2.8, which, for basic 2D draw and rendering from GDK, moved to graphical crossplatform library Cairo. Fortunately I had just met Luca, a colleague of my dear university companion Marco, who strongly suggested me to learn Cairo to draw points and lines, because GTK and GNOME community were migrating to that.
But until all 2008 Cygwin is packaged with GTK2.6 which is not based on Cairo. So I needed a method to integrate the most recent GTK version in Cygwin. I searched a little in Internet, but I could not find any guide for this purpose. Who works on Linux, finds compiling GTK applications trivial, because compiler, libraries and generation tools are bundled. But on Windows nothing is obvious, because the compiler is optional to buy separately. On the net I found a guide to compile GTK on Linux and you can found a lot of guides to compile the last GTK on the other port of gcc, the MinGW/MSYS, but nothing for Cygwin. After some attempts, I found the solution to compile the GTK 2.12 on Cygwin, so here is this guide.

First method, particularly well suited for Unix aware users, as you have all the tools you are accustomed to use in developing: state of the art editors, gcc, grep, nm, file, ecc...
HowTo use Cygwin to compile GTK+ v2.8+ and Cairo v1.4+ GUI crossplatform applications

Secondo method, if you are a Win32 only user, probably is best for you the Dev-C++ method as is an IDE that is so common on this simple platform.
HowTo use Dev-C++ to compile GTK+ applications


Go to EFA programming page
Back to main page:  EFA home page

Web site showed  times since 01/04/2000. 
From 20/10/1999 - 31/03/2000 the counter showed 770 visits, but it was resetted from the provider (so add 770 ...)

Copyright (C) 2006,2007,2008  Valerio Messina http://users.iol.it/efa
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts
and no Back-Cover Texts.  A copy of the license is included in the section entitled "GNU Free Documentation License" or
can be downloaded at: http://www.gnu.org/licenses/fdl.html