Trying ubuntu 16.04.1, and development seems hard...
Trivial test program:
$ cat app.cc
#include <gtkmm.h>
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "uk.ac.cam.bpi.app");
Gtk::Window window;
window.set_default_size(200,200);
return app->run(window);
}
$ cat Makefile.am
bin_PROGRAMS = app
app_SOURCES = app.cc
app_CXXFLAGS = $(GTKMM_CFLAGS)
app_LDFLAGS = $(GTKMM_LIBS)
$ cat configure.ac
AC_INIT([app], [1.0])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign])
AC_PROG_CXX
PKG_CHECK_MODULES([GTKMM],[gtkmm-3.0])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
First surprise:
Package gtkmm-3.0 was not found in the pkg-config search path.
gtkmm-3.0-dev was installed using apt install, and put in /usr/lib/x86_64-linux-gnu/pkgconfig, so I have to set PKG_CONFIG_PATH? Shouldn't pkg-config know that that is where -dev packages put .pc files by default?
$ echo $PKG_CONFIG_PATH
/usr/lib/x86_64-linux-gnu/pkgconfig
then compilation fails with:
g++ -I/usr/include/gtkmm-3.0 -I/usr/lib/x86_64-linux-gnu/gtkmm-3.0/include -I/usr/include/atkmm-1.6 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/giomm-2.4 -I/usr/lib/x86_64-linux-gnu/giomm-2.4/include -I/usr/include/pangomm-1.4 -I/usr/lib/x86_64-linux-gnu/pangomm-1.4/include -I/usr/include/cairomm-1.0 -I/usr/lib/x86_64-linux-gnu/cairomm-1.0/include -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/home/prlw1/pkg/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/gtk-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/mircookie -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/x86_64-linux-gnu/gdkmm-3.0/include -std=c++11 -pthread -g -O2 -L/usr/lib/x86_64-linux-gnu -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -o app app-app.o
app-app.o: In function `main':
/home/prlw1/gui/app/app.cc:5: undefined reference to `Glib::ustring::ustring(char const*)'
/home/prlw1/gui/app/app.cc:5: undefined reference to `Gtk::Application::create(int&, char**&, Glib::ustring const&, Gio::ApplicationFlags)'
/home/prlw1/gui/app/app.cc:5: undefined reference to `Glib::ustring::~ustring()'
/home/prlw1/gui/app/app.cc:6: undefined reference to `Gtk::Window::Window(Gtk::WindowType)'
/home/prlw1/gui/app/app.cc:7: undefined reference to `Gtk::Window::set_default_size(int, int)'
/home/prlw1/gui/app/app.cc:9: undefined reference to `Gtk::Application::run(Gtk::Window&)'
/home/prlw1/gui/app/app.cc:6: undefined reference to `Gtk::Window::~Window()'
/home/prlw1/gui/app/app.cc:6: undefined reference to `Gtk::Window::~Window()'
app-app.o: In function `main':
/usr/include/glibmm-2.4/glibmm/refptr.h:273: undefined reference to `Glib::ustring::~ustring()'
collect2: error: ld returned 1 exit status
Makefile:363: recipe for target 'app' failed
Puzzled as -lgtk-3 and -lglib-2.0 appear, and apt install libgtkmm-3.0-dev seemed to install the necessary packages.
Just tried the exact same example code above on NetBSD-current/amd64, and it succeeds with:
$ make
g++ -I/usr/pkg/include/gtkmm-3.0 -I/usr/pkg/lib/gtkmm-3.0/include -I/usr/pkg/include/atkmm-1.6 -I/usr/pkg/include/atk-1.0 -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include -I/usr/pkg/include/glibmm-2.4 -I/usr/pkg/lib/glibmm-2.4/include -I/usr/pkg/include/sigc++-2.0 -I/usr/pkg/lib/sigc++-2.0/include -I/usr/pkg/include/giomm-2.4 -I/usr/pkg/lib/giomm-2.4/include -I/usr/pkg/include/pangomm-1.4 -I/usr/pkg/lib/pangomm-1.4/include -I/usr/pkg/include/cairomm-1.0 -I/usr/pkg/lib/cairomm-1.0/include -I/usr/pkg/include/cairo -I/usr/X11R7/include/pixman-1 -I/usr/X11R7/include -I/usr/X11R7/include/freetype2 -I/usr/pkg/include/libpng16 -I/usr/X11R7/include -I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/harfbuzz -I/usr/pkg/include/gtk-3.0 -I/usr/pkg/include/gdk-pixbuf-2.0 -I/usr/pkg/include/glib/gio-unix-2.0/ -I/usr/pkg/include/at-spi2-atk/2.0 -I/usr/pkg/include/at-spi-2.0 -I/usr/pkg/include/dbus-1.0 -I/usr/pkg/lib/dbus-1.0/include -I/usr/pkg/include/gtk-3.0/unix-print -I/usr/pkg/include/gdkmm-3.0 -I/usr/pkg/lib/gdkmm-3.0/include -D_REENTRANT -pthread -g -O2 -L/usr/pkg/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -Wl,-R/usr/pkg/lib -lglib-2.0 -lintl -o app app-app.o
ld: warning: libintl.so.1, needed by /usr/pkg/lib/libgtkmm-3.0.so, may conflict with libintl.so.8
$