Templates and libraries

Nick.SIMON at syntegra.bt.co.uk Nick.SIMON at syntegra.bt.co.uk
Thu Mar 16 12:40:37 UTC 2000


Chaps,

In our build we create parts of the application code (mostly written in C++)
into libraries, which are finally linked together.

A problem has arisen because the linker dislikes the fact that two libraries
contain code for the same instantiated template class. Here's a snippet of
the error report:

../libs/libdownload.a(dlphantomparser.o): In function `vector<unsigned long,
__default_alloc_template<false, 0> >::allocate_and_fill(unsigned int,
unsigned long const &)':
/usr/local/rtems/include/g++/stl_vector.h:233: multiple definition of
`vector<unsigned long, __default_alloc_template<false, 0>
>::allocate_and_fill(unsigned int, unsigned long const &)'
../libs/libapp.a(dnlist.o):/usr/local/rtems/include/g++/stl_vector.h:233:
first defined here

I'm a bit puzzled that I don't just get multiple copies of the code
(although that's obviously not ideal).

Has anyone run into a similar problem, and found a way around it?

Thanks in advance,


-- Nick Simon 



More information about the users mailing list