[Insight-developers] compiling problems
Paul Hughett
hughett@mercur.uphs.upenn.edu
Thu, 11 Jan 2001 09:47:25 -0500
> Compiling...
> itkAffineTransformTest.cxx
> C:/Users/zhg/Insight/Code/Common+AFw-itkAffineTransform.txx(127) : error =
> C2572: 'Compose' : redefinition of default parameter : parameter 2
> C:/Users/zhg/Insight/Code/Common+AFw-itkAffineTransform.h(212) : =
> see declaration of 'Compose'
> C:/Users/zhg/Insight/Code/Common+AFw-itkAffineTransform.txx(145) : error =
> C2572: 'Translate' : redefinition of default parameter : parameter 2
> C:/Users/zhg/Insight/Code/Common+AFw-itkAffineTransform.h(221) : =
> see declaration of 'Translate'
This code compiles without problems on the Unix systems. It appears that
what the Microsoft compiler is complaining about is that a default parameter
is specified in both the declaration and the definition of a method; e.g.
// Declaration in *.h
void
AffineTransform<ScalarType, NDimensions>::
Compose(
const Self &other,
bool pre=0);
// Definition in *.txx
void
AffineTransform<ScalarType, NDimensions>::
Compose(
const Self &other,
bool pre=0)
{...}
Can someone more knowledgeble in C++ determine whether the code here
is wrong or whether the MS compiler is wrong? And, in either case,
what should we do about it?
Paul Hughett