Re: GTK+ library access issue?
- From: Paul Davis <paul linuxaudiosystems com>
- To: David Buchan <pdbuchan yahoo com>
- Cc: gtk-list list <gtk-list gnome org>
- Subject: Re: GTK+ library access issue?
- Date: Mon, 24 Oct 2011 22:54:34 -0400
On Mon, Oct 24, 2011 at 10:17 PM, David Buchan <pdbuchan yahoo com> wrote:
> ok. So, I did a complete reinstall of Ubuntu (it's relatively quick, so why
> This did nothing. Smae old story.
> I then got back on the net and tried Paul's suggestion:
> "Try putting it [-lm] at the end of the command, just for kicks."
> gcc test.c -lm
> Not only did that work for test.c, but it also solved my gtk problem!
> I'm gobsmacked.
> How come that works, but putting the lib flags before the filename(s)
the gnu linker follows a unix tradition of interpreting the list of
explicitly and implictly provided object files names as a dependency
order. consider two files, a.o and b.o. suppose that a.o uses a
function or symbol found only in b.o. in general, the linker will be
able to link these two if the order given is "a.o b.o" but not if its
there are exceptions to this even with the gnu linker, and certainly
with non-gnu linkers. but in general when you construct a link command
(such as "gcc -lm text.c") you need to think a bit about ordering
things so that when A has a dependency on B, A appears before B. this
applies whether its an explicit reference to an object file (like
"a.o") or something implicit like -lm or text.c
] [Thread Prev