Re: Problems linking c++ class libraries

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

 



"Mark L. Wise" <mark@xxxxxxxxxx> writes:

> I am relatively new to c++ and I have a question regarding linking class
> libraries.
> 
> I have a "main line" program that calls a class out of a library (A) that I
> built.  This class library also calls classes out of another library (B).
> When I try to link I get an unresolved call to <the class name> class
> (library B) that I call in library "A".
> 
> HOWEVER, If I include a "dummy" call in my "mainline" program to the class
> in library "B", then the link from library "A" completes to library "B" and
> the program runs.
> 
> Why do I have to include a reference call to the class in library "B" in my
> mainline program to get it the linker to resolve the link?

Please don't send messages to this mailing list by replying to an
unrelated message.  It breaks threaded mail readers.  Thanks.

Your bug report is incomplete, because you don't say precisely what
you are doing, or what type of system you are using, or what version
of the compiler and linker you are using.

However, my guess is that you don't realize that the order in which
you mention libraries on the command line matters.  If library A
refers to library B, then you must list them in the order -lA -lB.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux