pkg-config --libs gtk+-2.0 omits -mwindows on Windows



The GTK+ 2.0 Tutorial states that the command for compiling the hello
world application is:

$ gcc -Wall -g helloworld.c -o helloworld \
  `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

but this gives the wrong result when compiling on MSYS with MinGW.
The link command for GUI applications are normally given the -mwindows
option, so that the application does not create a console window when
run outside of MSYS, yet the output of pkg-config --libs gtk+-2.0
fails to include -mwindows.  The purpose of pkg-config is to allow
authors to easily write platform independent build scripts, so it
should include this option in its output.  For the unusual case in
which authors want console input in a GUI application, they should add
-mconsole option to the end of the link command line.

Failure to include -mwindows in pkg-config output is a real pain in
the neck for GNU autotools users.  One possible fix is to ask those
compiling the program to configure with:

$ ./configure LDFLAGS=-mwindows

This does not work for my application, GTK Sudoku.  It builds a GUI
program and a simple console only application.  The console only
application should not be linked with the -mwindows option.

Users of FLTK and wxWidgets would be surprised by the behavior of
pkg-config.  On Windows, their configure scripts, fltk-config and
wx-config, include -mwindows in their linker output, so it's easy to
write platform independent build files.

I attempted to submit a bug report on pkg-config at
bugzilla.gnome.org, but I get the message:

Sorry, entering bug reports into the product pkg-config has been
disabled.

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]