You are not logged in.

#1 2011-10-29 15:32:31

alip2890
Member
Registered: 2011-09-03
Posts: 3

mingw ld throws lots of undefined references

Hi,

I'm currently trying to use mingw for cross compiling a very simple GTK+ application:

#include <gtk/gtk.h>
#include <windows.h>

int
main(int argc, char* argv[])
{
  GtkWidget *window;
  gtk_init (&argc, &argv);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_show_all(window);
  gtk_main();
  return 0;
}

I installed all necessary mingw32 packages from the repos and AUR. The environment variables PATH, PKG_CONFIG_PATH and LD_LIBRARY_PATH are all well set. Then I try to compile with the following command:

i486-pc-mingw32-gcc -mwindows -mms-bitfields `i486-pc-mingw32-pkg-config --libs --cflags gtk+-2.0` gtkwindow.c -o gtkwindow.exe

Compiling works fine, but the linker won't do its job:

/tmp/ccFDgrYS.o:gtkwindow.c:(.text+0x34): undefined reference to `_gtk_init_abi_check'
/tmp/ccFDgrYS.o:gtkwindow.c:(.text+0x40): undefined reference to `_gtk_window_new'
/tmp/ccFDgrYS.o:gtkwindow.c:(.text+0x50): undefined reference to `_gtk_widget_show_all'
/tmp/ccFDgrYS.o:gtkwindow.c:(.text+0x55): undefined reference to `_gtk_main'
collect2: ld returned 1 exit status
make: *** [all] Fehler 1

Does anyone know what I'm missing here? I also tried mingw-cross-env recommended in some thread here and followed the tutorial: http://mingw-cross-env.nongnu.org/#tutorial but that didn't magically solve the problem. pkg-config output is OK: http://ompldr.org/vYjEzOA

Offline

Board footer

Powered by FluxBB