[Top][All Lists]

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

Re: Getting 'undefined reference' errors during linking but I think I in

From: Dale E Martin
Subject: Re: Getting 'undefined reference' errors during linking but I think I included all libraries?!?
Date: Fri, 2 May 2003 07:18:22 -0400
User-agent: Mutt/1.3.28i

> Not only that but if some libraries depend on other ones then you must be
> careful of the /order/ you specify all the -l guys in!!!
This has been true for a long, long time, I don't think it's a surprise to
most of the people on this list.  (And I agree with someone else who said
it should not matter where the -Ls go, I don't think that one matters
unless you've got some other problem, like multiple but different copies of
the same library.  And then the order of the -Ls would matter, but not if
they are before or after the -ls, I think.)

There are also circumstances where you have to list the same library
multiple times.  (Mostly in cases where you have circular dependencies
between libraries, iirc, it's been a long time since I've run into this
particular problem.)

The bright side of this coin is that now that you're using automake, it's
not too much harder to use libtool.  And if you use libtool properly,
specifying dependencies to all of your libtool libraries, and allow it to
link for you, it will handle the ordering for you automagically.  For me it
was the "killer feature" of libtool - much more so than portability which I
consider nice but non-critical for my particular app.  Note that libtool is
quirky and it's unpopular with some people, but I really like having the
libraries and linker understand the dependencies explicitly instead of
having to track them myself.

Take care,
Dale E. Martin, Clifton Labs, Inc.
Senior Computer Engineer
pgp key available

reply via email to

[Prev in Thread] Current Thread [Next in Thread]