Linker probs with template classes

Jacek Wojdel wojdel at chrysler.kbs.twi.tudelft.nl
Tue Jan 11 08:26:30 GMT 2000


On Mon, 10 Jan 2000, you wrote:
> I had this problem too for a while.  The compiler doesn't always handle
> template instatiation nicely when they are in separate files.  You can solve
> this problem by forward declaring the class in the circularArray.cpp file
> like this:
> 
> template class circularArray<int>;
> template class circularArray<float>;
> template class circularArray<MyClass>;
> etc...
> 
> (I think that's the right syntax.  It might be 'class template' instead. )
> 
> This forces to the compiler to instantiate those class templates in the
> current code module.
> (By the way, Tom Swan's "GNU C++ for Linux" book that was just published is
> very excellent, and covers alot of stuff like this.

There is also description of this issue in the GNU info pages. Just
jump to: gcc -> C++ Extentions ->  Template Instantiation

	Jacek
-- 
+-------------------------------------+
|from: J.C.Wojdel                     |
|      J.C.Wojdel at cs.tudelft.nl       |
+-------------------------------------+




More information about the KDevelop mailing list