[Insight-users] typedef name cannot follow class/struct/union

Neil.Burdett at csiro.au Neil.Burdett at csiro.au
Tue Feb 2 17:44:47 EST 2010


Hi Andreas and Bill,
                   Thanks for the replies. As mentioned in my previous post if I remove the "typename" I continue to get the same error:

"error C2242: typedef name cannot follow class/struct/union"

You are correct that the second line after this is a cut and paste error so the actual code is:

  // Compute the seed image, by closing cavities and holes with an ultimate skeleton of the cuboid image
  typedef itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;

  typename SeedSkeletonFilterType::Pointer seedSkeletonFilter = SeedSkeletonFilterType::New();
  seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
  seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
  seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
  try{
    seedSkeletonFilter->Update();
  } catch(itk::ExceptionObject &ex) {
    throw itk::ExceptionObject("milxTopologicalHolesFilling", 0, std::string("Topological holes filling.. seed ultimate skeleton failed: ") + ex.GetDescription());
  }

Anymore ideas? This error occurs on both VS 2005 and VS 2008

Cheers
Neil

-----Original Message-----
From: Andreas Schuh [mailto:andreas.schuh.84 at googlemail.com] 
Sent: Tuesday, 2 February 2010 2:49 PM
To: Burdett, Neil (ICT Centre, Herston - RBWH)
Cc: itk
Subject: Re: [Insight-users] typedef name cannot follow class/struct/union

Hi Neil,

Try

typedef  itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;

There is no typename specified necessary here. Actually, I think it's wrong to use it.

The second line after this one in your mail might just be a copy-and-paste relict while you were composing the mail. Because it doesn't make sense at all ...

The use of the second typename for the pointer type declaration is fine and for compilers like the VC6 also necessary.

Andreas


On Feb 1, 2010, at 11:20 PM, <Neil.Burdett at csiro.au> wrote:

> Hi Bill and Dan,
>        thanks for the reply, but removing typename, or replacing it with ITK_TYPENAME gives exactly the same error in visual studio 2008;
> 
> "error C2242: typedef name cannot follow class/struct/union"
> 
> The full extract of code I'm using is;
> 
>  // Compute the seed image, by closing cavities and holes with an ultimate skeleton of the cuboid image
>  typedef typename itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
>  itk::UltimateSkeletonImageFilter<TOutputImage, TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType > SeedSkeletonFilterType;
> 
>  typename SeedSkeletonFilterType::Pointer seedSkeletonFilter = SeedSkeletonFilterType::New();
>  seedSkeletonFilter->SetInput(cuboidImage->GetOutput());
>  seedSkeletonFilter->SetPriorityImage(distanceInvertIntensityFilter->GetOutput());
>  seedSkeletonFilter->SetInhibitImage(parallelSkeletonFilter->GetOutput());
>  try{
>    seedSkeletonFilter->Update();
>  } catch(itk::ExceptionObject &ex) {
>    throw itk::ExceptionObject("milxTopologicalHolesFilling", 0, std::string("Topological holes filling.. seed ultimate skeleton failed: ") + ex.GetDescription());
>  }
> 
> Neil
> 
> -----Original Message-----
> From: Bill Lorensen [mailto:bill.lorensen at gmail.com] 
> Sent: Monday, 1 February 2010 11:46 PM
> To: Burdett, Neil (ICT Centre, Herston - RBWH)
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] typedef name cannot follow class/struct/union
> 
> I think the typename can be removed on both Windows and linux. My
> general rule for typename is that it is required if there are no
> template variables.
> 
> For example
> 
> typedef Foo<bar> FooBarType;
> 
> typedef typename Foo::Pointer FooPointer;
> 
> On Sun, Jan 31, 2010 at 11:39 PM,  <Neil.Burdett at csiro.au> wrote:
>> Hi,
>> 
>>     I am currently porting an application from Ubuntu to windows. The line
>> of code below compiles on Ubuntu but not on visual studio...
>> 
>> 
>> 
>>   typedef typename itk::UltimateSkeletonImageFilter<TOutputImage,
>> TOutputImage, itk::Connectivity<Dimension, 0>, DistanceImageType >
>> SeedSkeletonFilterType;
>> 
>> 
>> 
>> I receive the error in visual studio 2008 "error C2242: typedef name cannot
>> follow class/struct/union"
>> 
>> 
>> 
>> Any help would be appreciated.
>> 
>> 
>> 
>> Neil
>> 
>> _____________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>> 
>> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list