[Insight-developers] Test programs that won't compile

Will Schroeder will.schroeder@kitware.com
Sun, 03 Dec 2000 07:41:35 -0500


Hi Lydia-

I found the same problem. I haven't yet made any changes, do you want me to
or are you going to check your fixes in?

Will

At 05:01 PM 12/1/00 -0800, Lydia Ng wrote:

>Unfortunately, VC++ can't handle the keyword typename inside the template
>parameter list:
>
>e.g. lines 100-103 itkRandomImageSource.h
>   itkSetClampMacro(Min,typename TOutputImage::ScalarValueType,
>                    NumericTraits<typename
>TOutputImage::ScalarValueType>::min(),
>                    NumericTraits<typename
>TOutputImage::ScalarValueType>::max());
>
>The only way I can figure to get around this is to do a separate typedef
>outside
>the template parameter list, so both VC++ and gcc are satisfied.
>
>FYI the compile error message is:
>f:\lng\projects\insight-clean\insight\code\common\itkrandomimagesource.h(100
>) : error C2899: typename cannot be used outside a template declaration
>
>f:\lng\projects\insight-clean\insight\code\common\itkrandomimagesource.h(100
>) : while compiling class-template member function 'void __thiscall
>itk::RandomImageSource<class itk::Image<class itk::Scalar<float>,2,class
>itk::ValarrayImageContai
>ner<unsigned long,class itk::Scalar<float> > > >::SetMin(float)'
>
>Lydia
>
>----- Original Message -----
>From: "Joshua Cates" <cates@cayenne.cs.utah.edu>
>To: "Paul Hughett" <hughett@mercur.uphs.upenn.edu>
>Cc: <insight-developers@public.kitware.com>
>Sent: Tuesday, November 28, 2000 10:39 AM
>Subject: Re: [Insight-developers] Test programs that won't compile
>
>
> > Fixed itkRandomImageSource.  Only required the addition of a few
> > typename's here and there (hopefully not stepping on anyone's toes by
> > doing that).  Unfortunately it looks like itkWriteVTKImage is also broken.
> > Can't easily tell what's wrong there.
> >
> > I've checked in a new version of itkUUImageToImageFilterDriver.h which
> > avoids using those two classes altogether and should allow these test
> > programs (excepting itkNeighborhoodOperatorTest) to compile. You may or
> > may not get warnings associated with the use of itk::Scalar and the way
> > the compiler implicitly overloads itk::Scalar's operators.
> >
> > Josh.
> >
> > +--+--+--+--+--+--+--+--+--+--+--+--
> >  Josh Cates
> >  Department of Computer Science
> >  University of Utah
> >  Email: cates@cs.utah.edu
> >  Phone: (801) 587-7697
> >  URL:   www.cs.utk.edu/~cates
> > --+--+--+--+--+--+--+--+--+--+--+---
> >
> > On Tue, 28 Nov 2000, Paul Hughett wrote:
> >
> > >
> > > Attempting to compile itkFilterImageAnisotropicDiffusionTest, last
> > > updated on Monday morning, using gcc 2.95.2 under Linux yields the
> > > following error messages:
> > >
> > >
>c++  -g -O2   -I/home/hughett/work/Insight -I/home/hughett/work/Insight/Code
>/Insight3DParty/vxl -I/home/hughett/work/Insight/Code/Common -I/home/hughett
>/work/Insight/Code/Insight3DParty/vxl    -c
>itkFilterImageAnisotropicDiffusionTest.cxx -o
>itkFilterImageAnisotropicDiffusionTest.o
> > > In file included from itkUUImageToImageFilterDriver.h:24,
> > >                  from itkFilterImageAnisotropicDiffusionTest.cxx:20:
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:100: parse
>error before `)'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>`TOutputImage::ScalarValueType' is not a valid declarator
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>perhaps you want `typename TOutputImage::ScalarValueType' to make it a type
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: parse
>error before `('
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>syntax error before `<'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>invalid use of member `itk::RandomImageSource<TOutputImage>::itkmsg'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids declaration `itkmsgbuff' with no type
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids initialization of member `itkmsgbuff'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>making `itkmsgbuff' static
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids in-class initialization of non-const static member `itkmsgbuff'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids declaration `OutputWindowDisplayText' with no type
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids initialization of member `OutputWindowDisplayText'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>making `OutputWindowDisplayText' static
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: ANSI
>C++ forbids in-class initialization of non-const static member
>`OutputWindowDisplayText'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107:
>syntax error before `.'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h: In method
>`void itk::RandomImageSource<TOutputImage>::SetMin(...)':
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:101: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:101:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:101: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:101:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102: to
>refer to a type member of a template parameter,
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:102:   use
>`typename TOutputImage::ScalarValueType'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h: At top
>level:
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:107: parse
>error at null character
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>`TOutputImage' was not declared in this scope
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113: parse
>error before `::'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>virtual outside class declaration
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h: In
>function `void SetMax(...)':
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>invalid use of `this' in non-member function
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>`Object' undeclared (first use this function)
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113: (Each
>undeclared identifier is reported only once
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113: for
>each function it appears in.)
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113: parse
>error before `::'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>invalid use of `this' in non-member function
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>invalid use of `this' in non-member function
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>invalid use of `this' in non-member function
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>invalid use of `this' in non-member function
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>`_arg' undeclared (first use this function)
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>`itkmsgbuff' undeclared (first use this function)
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>implicit declaration of function `int OutputWindowDisplayText(...)'
> > > /home/hughett/work/Insight/Code/Common/itkRandomImageSource.h:113:
>confused by earlier errors, bailing out
> > > make: *** [itkFilterImageAnisotropicDiffusionTest.o] Error 1
> > >
> >
> >
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
>
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers