Template Class Problem

Mike Stump mrs@wrs.com
Fri Apr 30 23:15:00 GMT 1999


> From: Gerald Gutierrez <gutier@intergate.bc.ca>
> To: egcs-bugs@egcs.cygnus.com
> Date: Tue, 27 Apr 1999 00:33:50 -0700

> Below is what I believe to be another problem with templates.

Yes and no.  Yes, long term the compiler will switch over to work how
you expect.  We know about this.  But, it is unlikely to happen
anytime soon.  In the mean time, you must include all definitions in
all files that make any use of templates.  This is a limitation of
many C++ compilers.

> I've got a parameterized class called Alpha within the files
> Alpha.cc and Alpha.h.  They compile fine but after the compile
> Alpha.o doesn't contain any symbols relating to the Alpha class!

It is working as designed.  Use -frepo, or try defining the termplates
in all files that use them.



More information about the Gcc-bugs mailing list