[Insight-developers] linking issue

Joshua Cates cates@cs.utah.edu
Wed, 28 Nov 2001 10:41:09 -0700 (MST)


Hi all,

I have a linking issue that I've not see before with itk.  The problem
applies to templated code in general.  Suppose I have two .o files that
have instantiated some of the same templated methods using the same
template parameters. When I link against these two files, the linker finds
multiple definitions for those methods.  This must be a well known
problem, how do I get around it?  Is this when I use manual instantiation?

(For example, suppose I create a gui library itkFilters.a with widgets
Filter1.o Filter2.o, where Filter1 and Filter2 both instantiate
itkFooImageFilter<float>.  An executable linking against itkFilters.a 
encounters multiply defined methods.)

Thanks,

Josh.
______________________________
 Josh Cates			
 School of Computer Science	
 University of Utah
 Email: cates@cs.utah.edu
 Phone: (801) 587-7697
 URL:   www.cs.utk.edu/~cates