v3 template errors

Martin Reinecke martin@MPA-Garching.MPG.DE
Tue May 29 06:11:00 GMT 2001


Hi Alonzo,

I think that the programs in v3template-error.tar.gz
are not completely conforming to standard C++, because
of the definitions of template methods in .C files
which are compiled separately (in SomeTemplate.C and
SimpleList.C). Whenever you have that kind of definition,
it must be preceded by the "export" keyword, or your
programs won't link. This is better explained in
section 13.7 of "The C++ Programming Language (3rd edition)".
In principle the SGI compiler should have complained about
your code.

Unfortunately the export keyword is one of the few standard C++
features which have not yet been implemented in gcc, so I fear
this won't help you much. Your best bet is to rearrange the
source code (e.g. move the definitions of the template members
into the headers).

Hope this helps a bit,
  Martin



More information about the Gcc mailing list