build problem on windows/cygwin/mingw

Sven Luther <[email protected]> Sun, 27 Apr 2003 17:59:57 +0200
Newsgroups gmane.comp.video.gimp.windows.devel
Message-ID <20030427155957.GA2198@iliana>
Hello, ...

I have a cygwin install on windows, which does everything right when i
compile a non gtk+ app. I installed it with the nice cygwin setup
program.

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

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. I hand-modified those to have an /usr
prefix, which is where i think the libs are :

ls /usr/lib gives me :

atk-1.0.lib         libfontconfig-1.dll      libgthread-2.0-0.dll
freetype-6.def      libfreetype.a            libgthread-2.0.dll.a
gdk_pixbuf-2.0.lib  libfreetype-bcc.def      libgtk-win32-2.0-0.dll
gdk-win32-2.0.lib   libfreetype-bcc.lib      libgtk-win32-2.0.dll.a
glib-2.0            libfreetype.dll.a        libpango-1.0-0.dll
glib-2.0.def        libfreetype.la           libpango-1.0.dll.a
glib-2.0.lib        libfreetype.lib          libpangoft2-1.0-0.dll
gmodule-2.0.def     libgdk_pixbuf-2.0-0.dll  libpangoft2-1.0.dll.a
gmodule-2.0.lib     libgdk_pixbuf-2.0.dll.a  libpangowin32-1.0-0.dll
gobject-2.0.def     libgdk-win32-2.0-0.dll   libpangowin32-1.0.dll.a
gobject-2.0.lib     libgdk-win32-2.0.dll.a   locale
gthread-2.0.def     libglib-2.0-0.dll        pango
gthread-2.0.lib     libglib-2.0.dll.a        pango-1.0.lib
gtk-2.0             libgmodule-2.0-0.dll     pangoft2-1.0.lib
gtk-win32-2.0.lib   libgmodule-2.0.dll.a     pangowin32-1.0.lib
libatk-1.0-0.dll    libgobject-2.0-0.dll     pkgconfig
libatk-1.0.dll.a    libgobject-2.0.dll.a

But, when building the hello-gtk.c program with :

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

i get :

/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1c):hello-gtk.c: undefined reference to `g_print'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x48):hello-gtk.c: undefined reference to `g_print'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x5b):hello-gtk.c: undefined reference to `gtk_main_quit'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0xcf):hello-gtk.c: undefined reference to `gtk_init_abi_check'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0xdb):hello-gtk.c: undefined reference to `gtk_window_new'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0xf1):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x121):hello-gtk.c: undefined reference to `g_signal_connect_data'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x134):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x164):hello-gtk.c: undefined reference to `g_signal_connect_data'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x169):hello-gtk.c: undefined reference to `gtk_container_get_type'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x17a):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x18a):hello-gtk.c: undefined reference to `gtk_container_set_border_width'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x196):hello-gtk.c: undefined reference to `gtk_button_new_with_label'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1ac):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1dc):hello-gtk.c: undefined reference to `g_signal_connect_data'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x1ef):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x204):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x217):hello-gtk.c: undefined reference to `gtk_widget_destroy'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x230):hello-gtk.c: undefined reference to `g_signal_connect_data'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x235):hello-gtk.c: undefined reference to `gtk_container_get_type'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x246):hello-gtk.c: undefined reference to `g_type_check_instance_cast'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x255):hello-gtk.c: undefined reference to `gtk_container_add'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x260):hello-gtk.c: undefined reference to `gtk_widget_show'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x26b):hello-gtk.c: undefined reference to `gtk_widget_show'
/cygdrive/c/WINDOWS/TEMP/ccNrduy9.o(.text+0x270):hello-gtk.c: undefined reference to `gtk_main'

Which clearly seem to indicate that gcc is not finding the glib/gtk
libraries when linking. I have verified, on my linux box, these symbols
are in the glib and gtk libraries, as their name indicates.

What am i doing wrong, please help me, i am urgently needing to compile
a program i did using gtk+ for windows, and it is already 4 evening or
so that i am loosing in trying to get windows to behave without much
sucess.

It would be so much simpler if cygwin also provided the gtk+ libraries,
i don't understand why they do not.

BTW, i have tried with both the pkg-config from cygwin, and the one from
the web page, without any difference.

Thanks in advance, and i hope i rightly figured out how to write to this
mailing list.

Friendly,

Sven Luther