Development

Cross platform coding using GTK+ / GTKmm

Cross platform development is a method of compiling the same application on different operating systems using the same source code. There are a number of GUI libraries that make cross platform development easier, such as wxWidgets and Qt. There are also frameworks such as Mono (which is a Linux implementation of the .NET framework).

I decided that I wanted to code in C++, and initially looked at wxWidgets. Eventually though, I settled on GTK+ (the GUI libraries used for GIMP and the Gnome desktop). The C++ bindings for GTK+ are known as GTKmm. Setting up an IDE to do this in Linux is pretty easy...

NetBeans on Linux with GTKmm

As root, install the relevant applications and libraries:

yum install netbeans glibmm24-devel cairomm-devel pangomm-devel gtkmm24-devel gtkmm24-docs libglademm24-devel

Start NetBeans and select Tools > Plugins. Install "C/C++" from the list of available plugins. Then create a new project using: "File > New Project > C/C++ > C/C++ Application". Complete the setup of the project by entering the relevant information (e.g. location and name of project, etc.).

Right click on the project, select "Properties". Then select "Build > C++ Compiler". Select a configuration from the drop down (e.g. Release (active)) and click the triple dots next to "Additional options". Add the following to additional options:

-I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/giomm-2.4 -I/usr/lib/giomm-2.4/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/include/cairomm-1.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/atk-1.0 -I/usr/include/libglademm-2.4

Next, under "Linker", Select a configuration from the drop down (e.g. Release (active)) and click the triple dots next to "Libraries". Then add the following under "Add Option > Other Option":

-lgtkmm-2.4 -lgiomm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lcairomm-1.0 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lglademm-2.4	-lgtkmm-2.4 -lgiomm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lcairomm-1.0 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lglademm-2.4	-lgtkmm-2.4 -lgiomm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lcairomm-1.0 -lglibmm-2.4 -lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lglademm-2.4

With any luck, you will now be able to successfully compile GTKmm applications under Fedora.

Dev-C++ and Eclipse with GTKmm on Windows

The following may be of use for setting up GTKmm on Windows, though it is actually for Eclipse / Dev-C++ rather than NetBeans, and is rather out of date (last updated 17/08/2008). Needs a re-write...

Installing GTKmm on Windows (with Dev-C++ and Eclipse IDEs) - PDF

Installing GTKmm on Windows (with Dev-C++ and Eclipse IDEs) - ODT