I installed gtkmm 3 on Ubuntu 13.04 using aptitude (I like aptitude because it remembers what was installed when you want to remove it):
sudo aptitude install libgtkmm-3.0-dev --with-recommends
Using codelite 5.1.2 and the default gtk++ tool chain, in my compiler include paths I added:
/usr/include/gtkmm-3.0 - the path to gtkmm.h
I tried to build the first sample app in Programming with GTKMM:
#include <gtkmm.h>
int main ( int argc, char *argv[] )
{
Gtk::Main kit ( argc, argv );
Gtk::Window window;
Gtk::Main::run ( window );
return 0;
}
After chasing down a few 'include file not found' errors coming from gtkmm.h, which includes the entire gtkmm framework, my compiler include path now looks like this:
/usr/include/gtkmm-3.0
/usr/include/glibmm-2.4
/usr/lib/i386-linux-gnu/glibmm-2.4/include
/usr/include/glib-2.0
And all hell is breaking loose from glib.h:
/bin/sh -c 'make -j 4 -e -f "Calendars_wsp.mk"' ----------Building project:[ CalendarsGUI - Debug ]---------- ........ /gtkmm-3.0 -I/usr/include/glibmm-2.4 -I/usr/lib/i386-linux-gnu/glibmm-2.4/include -I//usr/include/glib-2.0 In file included from //usr/include/glib-2.0/glib/gtypes.h:36:0, from //usr/include/glib-2.0/glib/galloca.h:34, from //usr/include/glib-2.0/glib.h:32, from /usr/include/glibmm-2.4/glibmm/thread.h:46, from /usr/include/glibmm-2.4/glibmm.h:87, from /usr/include/gtkmm-3.0/gtkmm.h:87, from main.cpp:16: ***//usr/include/glib-2.0/glib/gversionmacros.h:179:2: error: #error "GLIB_VERSION_MIN_REQUIRED must be >= GLIB_VERSION_2_26"*** In file included from //usr/include/glib-2.0/glib/galloca.h:34:0, from //usr/include/glib-2.0/glib.h:32, from /usr/include/glibmm-2.4/glibmm/thread.h:46, from /usr/include/glibmm-2.4/glibmm.h:87, from /usr/include/gtkmm-3.0/gtkmm.h:87, from main.cpp:16: ***//usr/include/glib-2.0/glib/gtypes.h:448:2: error: #error unknown ENDIAN type ....... make: *** [All] Error 2 2 errors, 2 warnings***
(I also had the same problems when trying to use gtkmm 2.4)
Obviously I am missing something here. What am I doing wrong? What else do I need to do to build gtkmm projects?
When using gtkmm, its advised to use the pkg-config tool. You can do this from codelite as well:
Right click on your project: Settings -> Common Settings -> Compiler -> C++ Compiler options: and add:
$(shell pkg-config gtkmm-3.0 --cflags)
If you have another options, they should be semi-colon delimited
Next, add the following to the linker options: Right click on your project: Settings -> Common Settings -> Linker -> Options:
$(shell pkg-config gtkmm-3.0 --libs)
again, if you have another options, they should be semi-colon delimited
Remove all the hard coded include paths you added the above 2 should suffice
Note:
This exact question was also answered on codelite's forum: http://forums.codelite.org/viewtopic.php?f=11&t=1396&p=6416&hilit=gtkmm#p6410
Eran