Re: Problems when (cross)compiling a gtk app on linux for windows



Then I did pkg-config --cflags --libs gtk+-2.0 to obtain the package names and linker flags I need,

In general it is wrong to pass both the --cflags and --libs options to
pkg-config at once and use the output of that in one place on the
compilation line. It just happens to work with gcc in general to have
the -I flags even after the source file names, and on Linux it just
happens to work to have the -L flags before source or object files.
The more traditional and canonical ordering of options require a
separate use of pkg-config --cflags and pkg-config --libs, like this:

<compiler> <compiler flags not in .pc files> -o <output> `pkg-config
--cflags <deps>` sources.c or objects.o `pkg-config --libs <deps>`
<other libraries>

and changed all the paths from it so it points all to ./gtk/ which resulted in the following command:

i486-mingw32-gcc -o LPHirc.exe ./lphirc_main.c -mwindows -lws2_32 -I./gtk/include/gtk-2.0 
-I./gtk/include/gtk-2.0/gtk -I./gtk/include/gtk-2.0/gdk -I./gtk/include/atk-1.0 -I./gtk/include/cairo 
-I./gtk/include/pango-1.0 -I./gtk/include/glib-2.0 -I./gtk/lib/glib-2.0/include -I./gtk/include/freetype2 
-I./gtk/include/libpng12 -I./gtk/include/pixman-1 -L./gtk/bin -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 
-lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0

I don't see any -I./gtk/lib/gtk-2.0/include there, which is expected,
and would point to the folder where gdkconfig.h is, which is the
header that defines the GSEAL macro. Are you sure you didn't see any
error message about a missing gdkconfig.h? That would have been the
first error message most likely, and the others then caused by that.
If you did not see such a message, you are probably then by mistake
including some older copy of gdkconfig.h that you happen to have
(misguidedly?) copied somewhere in the other folders searched, or the
folder where your source file is.

--tml



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