Re: GLib 2.0 + MinGW: Linking errors (?)



> I have included glib-2.0 as "#include <glib-2.0/glib.h>"

The correct way is to say #include <glib.h>, and pass the -I flag accordingly.

> and compiled using the following line:

> C:\mingw\bin\gcc.exe qcrawl-1.5.c  -Ic:/mingw/include/glib-2.0  -lregex -lglib-2.0

The convention is to put the -I flags before the source file names.
Maybe indeed putting them after the source files works, too, (I didn't
even know that) but why invent new conventions? It makes it easier to
read other people's code (and compilation lines, for instance from
makefiles, can be considered as code, too) if everybody follows
roughly the same conventions. Just like it is a only a convention to
call the arguments to main() argc and argv... nothing bad happens if
you call them i and a instead, but you will just confuse your readers.

You will need to pass also -Ic:/mingw/lib/glib-2.0/include so that gcc
will find glibconfig.h. That header is in "$prefix/lib" because it is
platform dependent. The headers in "$prefix/include" are
platform-independent. Although I doubt anybody actually has GLib
installed so that the "include" folder is shared between different
platform machines, the intention is that it should be possible.

(And actually I would have recommented against installing the glib
stuff in your mingw folder. My personal preference is to keep stuff
from different sources in different prefixes. Makes it easier to blow
away one thing completely and install freshly.)

> I don't know if it will help much, but here's one of the lines from the
> error output (towards the end, as the rest scrolled past my buffer and I
> cannot direct it to a file using >):

Well, the last error messages are often pointless, it's the first
error that usually is the most relevant, and the rest are then just
consequences of the first one... My guess is that the errors are
caused by glibconfig.h not being found.

Why do you think you can't redirect? Redirecting standard output with
> and standard error with 2> work even in cmd.exe if that is what you
are using. Also 2>&1 works in cmd.exe... (But unfortunately that is
about the most complex Unixish thing cmd.exe does. No backtick syntax,
for instance. And the command-line quoting mechanisms are very
different than on Unix.)

--tml


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