This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Template ctor/dtor undefined at link


Robert Boehne wrote:
> I can't determine whether this particular problem is a compiler
> problem or a (most likely) programmer error.  I have a template
> class with a constructor that takes a pointer to the template
> argument, gcc 3.0.1 x86 Linux and Aix 4.3 as well as egcs-2.91.66
> all have unresloved symbols at link time, some other compilers don't.
This is user error. Until 'export' is implemented, the bodies of
template functions must be visible at the point of instantiation (roughly
speaking). Or you could explicitly instantiate them for all the required
types where they are visible.

They need to be as visible as inline functions are. Don't worry about
multiple instantiations of the specialization causing linker problems --
it knows to ignore all but one.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]