Stop Console Popup Problem: Gtkmm Windows

Stop Console Popup Problem: Gtkmm Windows

Fed up with the .dll overheads of wxPython and Python, I’m using gtkmm as my standard GUI toolkit from now on.

I’ve got all the libraries installed on Windows XP and Slackware using the gtkmm documentation, so I’m looking forward to nice portable apps.

There was one slight problem that had me stumped: on Windows the executable causes a console window to pop up along with the main GUI. I Googled to no avail, until today; evidently a fresh pair of eyes brings a new perspective to the problem. If you’re using Dev-C++ go to “Project” → “Type” and select “Win32 GUI”. I don’t know how I missed that one, then again it was about 11:30pm.

What this does is add the -mwindows flag to the g++ compiler. If you’re interested, here are my C++ compiler flags:

-IC:/Dev-Cpp/include/gtkmm/include/gtkmm-2.4 -IC:/Dev-Cpp/include/gtkmm/lib/gtkmm-2.4/include -IC:/Dev-Cpp/include/gtkmm/include/glibmm-2.4 -IC:/Dev-Cpp/include/gtkmm/lib/glibmm-2.4/include -IC:/Dev-Cpp/include/gtkmm/include/gdkmm-2.4 -IC:/Dev-Cpp/include/gtkmm/lib/gdkmm-2.4/include -IC:/Dev-Cpp/include/gtkmm/include/pangomm-1.4
-IC:/Dev-Cpp/include/gtkmm/include/atkmm-1.6
-IC:/Dev-Cpp/include/gtkmm/include/sigc++-2.0 -IC:/Dev-Cpp/include/gtkmm/lib/sigc++-2.0/include
-IC:/GTK/include/gtk-2.0 -IC:/GTK/include/glib-2.0
-IC:/GTK/lib/glib-2.0/include -IC:/GTK/lib/gtk-2.0/include
-IC:/GTK/include/pango-1.0 -IC:/GTK/include/atk-1.0

Also my linker flags:

-LC:/Dev-Cpp/include/gtkmm/lib -LC:/GTK/lib -lgtkmm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-win32-2.0 -lpangomm-1.4 -lglibmm-2.4 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv

I didn’t get all those by hand either, use pkg-config from the console prompt with the instructions as outlined in the documentation. If you’re unsure of how to set the PATH environmental variable in Windows, you might want to have a look at my gpg for Windows post.