Cabeçalhos e vinculação

Although we have shown the compilation command for the simple example, you really should use the automake and autoconf tools, as described in "Autoconf, Automake, Libtool", by G. V. Vaughan et al. The examples used in this book are included in the gtkmm-documentation package, with appropriate build files, so we won't show the build commands in future. You'll just need to find the appropriate directory and type make.

Para simplificar a compilação, usaremos o pkg-config, que está presente em todas as instalações do gtkmm (se instaladas apropriadamente). Esse programa "sabe" quais opções de compilador são necessárias para compilar os programa que usam gtkmm. A opção --cflags faz com que o pkg-config emita uma lista de diretórios de inclusão para o compilador buscar; a opção --libs solicita a lista de bibliotecas às quais o compilador deve vincular e os diretórios onde achá-los. Experimente executá-lo no seu prompt do shell para ver os resultados no seu sistema.

However, this is even simpler when using the PKG_CHECK_MODULES() macro in a standard configure.ac file with autoconf and automake. For instance:

PKG_CHECK_MODULES([MYAPP], [gtkmm-3.0 >= 3.8.0])
This checks for the presence of gtkmm and defines MYAPP_LIBS and MYAPP_CFLAGS for use in your Makefile.am files.

gtkmm-3.0 is the name of the current stable API. There was an older API called gtkmm-2-4 which installs in parallel when it is available. There were several versions of gtkmm-2.4, such as gtkmm 2.10 and there are several versions of the gtkmm-3.0 API. Note that the API name does not change for every version because that would be an incompatible API and ABI break. Theoretically, there might be a future gtkmm-4.0 API which would install in parallel with gtkmm-3.0 without affecting existing applications.

Note que se você mencionar módulos além do gtkmm-3.0, eles seriam separados por espaços, e não por vírgulas.

Openismus tem mais ajuda básica sobre automake e autoconf.