[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libraries within libraries
From: |
Bob Rossi |
Subject: |
Re: libraries within libraries |
Date: |
Tue, 29 Apr 2003 15:18:02 -0400 |
User-agent: |
Mutt/1.3.28i |
Hi,
I have the same question.
I like the nice design of having each subdir build its own library.
However, I would like to be able to export a library containing all of
the objects in all the libraries.
What would be the best way to do this?
Thanks,
Bob Rossi
On Tue, Apr 29, 2003 at 08:10:01PM +0000, Marco Correia wrote:
>
> I have a library project stored like this:
> -src
> |- dir1
> |- dir2 -- subdir21
> |- subdir22
> |- dir3
>
> and I have noinst libraries for each dir and subdir. I want to build a static
> library libsrc.a in \src (the root) containing all the object files in the
> tree structure, so in the makefile.am of src I wrote:
>
> libsrc_a_LIBADD = $(top_builddir)/dir1/libdir1.a
> $(top_builddir)/dir1/libdir2.a $(top_builddir)/dir2/subdir21/libsub21.a ...
> etc.
>
> Everything compiled and linked fine and when I do an "ar -t libsrc.a" I get
>
> some_objects_stored_in_src_dir.o
> libdir1.a
> libdir2.a
> libsubdir21.a
> ... etc
>
> Now the problem is whenever I try to link libsrc.a with an example source
> that
> uses the library
>
> g++ -g -O2 -o example1 example1.o ../library/libsrc.a
>
> I get lots of undefined references to classes in the library in the link
> phase.
>
> But if I build libsrc as a shared library I have no problems of any sort.
>
> What could be the cause of this?
>
> thanks
> Marco
>
> Marco Correia <address@hidden>
>
>