build problem on windows/cygwin/mingw

Tor Lillqvist <[email protected]> Sun, 27 Apr 2003 20:52:59 +0300
Newsgroups gmane.comp.video.gimp.windows.devel
Message-ID <[email protected]>
Sven Luther writes:
 > I have a cygwin install on windows

 > I tried installing the gtk+ packages from
 > http://www.gimp.org/~tml/gimp/win32/index.html, but am not having sucess
 > with it.

If you want to build Cygwin applications, you shouldn't. Those are for
"native" Win32, not Cygwin. (But read on.)

 > First problem was that i don't really know where to install them. since
 > the packages include /lib, /bin and such, the natural way would be to
 > unzip them in /usr, which i did. But i quickly noticed that the
 > pkg-config configuration files of these packages use a /target/build
 > prefix, which naturally is wrong.

The pkg-config program has been especially enhanced to take care of
this. When compiled for Win32 (*not* if compiled for Cygwin, which is
just a particular kind of Unix), it automatically replaces the
"prefix" variable in .pc filles with the actual prefix deduced at
run-time from the location of the .pc file.

 > gcc -mno-cygwin -mms-bitfield `pkg-config --cflags --libs gtk+-2.0`
 > -o hello-gtk hello-gtk.c

If you are using -mno-cygwin, then those runtime and developer
packlages you downloaded should be OK. But on the other hand, then you
shouldn't install them in /usr/lib, which is for Cygwin stuff only.

 > /cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1c):hello-gtk.c: undefined reference to `g_print'

You need to have the libs after the C files on the compiler command
line. Try this:

gcc -mno-cygwin -mms-bitfield `pkg-config --cflags gtk+-2.0` -o hello-gtk hello-gtk.c `pkg-config --libs gtk+-2.0`

--tml