[Insight-developers] compiling problems

Bill Hoffman bill.hoffman@kitware.com
Thu, 11 Jan 2001 09:54:08 -0500


The code is wrong and so is g++ on unix.   You can only define
default parameters in one place.  Best place is the .h file.

-Bill


At 09:47 AM 1/11/01 -0500, Paul Hughett wrote:


> > 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
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers