[Insight-users] Problem with VC.NET 7.1

Luis Ibanez luis.ibanez at kitware.com
Tue Aug 3 22:54:25 EDT 2004


Hi Ender

Why do you have the header guards commented out ?

 > /*
 > #ifndef __itkEnhancingLevelSetFunction_h_
 > #define __itkEnhancingLevelSetFunction_h_
 > */

and still have the (uncommented) #endif at the
end of your .h file ?


You are also including the .cpp file  at the end of the
header

>> 
>> #ifndef ITK_MANUAL_INSTANTIATION
>> #include "EnhancingLevelSetFunction.cpp"
>> #endif
>> 


If that .cpp file contains the implementation of the
templated class... then you better use extension .txx
because otherwise VisualStudio will attempt to compile
this file.


Please fix the guards of the header file, because if
you are including this header from your .cpp file,
then you are running into a recursive (infinite)
inclusion.




    Regards,


       Luis



------------------------------
konukoge at boun.edu.tr wrote:

> Ok the problematic code is given below:
> 
> //////////////////////////////
> #if
> !defined(AFX_ENHANCINGLEVELSETFUNCTION_H__957ACCF4_DE3C_4A53_AA8D_DF2B59F84FD9__INCLUDED_)
> #define
> AFX_ENHANCINGLEVELSETFUNCTION_H__957ACCF4_DE3C_4A53_AA8D_DF2B59F84FD9__INCLUDED_
> 
> #if _MSC_VER > 1000
> #pragma once
> #endif // _MSC_VER > 1000
> 
> /*
> #ifndef __itkEnhancingLevelSetFunction_h_
> #define __itkEnhancingLevelSetFunction_h_
> */
> #include "itkSegmentationLevelSetFunction.h"
> #include "itkNumericTraits.h"
> 
> namespace itk
> {
> 	template< class TImageType, class TFeatureImageType = TImageType >
> 		class ITK_EXPORT EnhancingLevelSetFunction : public
> SegmentationLevelSetFunction<TImageType, TFeatureImageType>
> 
> {
> public:
> 	typedef EnhancingLevelSetFunction Self;
> 	typedef SegmentationLevelSetFunction<TImageType, TFeatureImageType>
> Superclass;
> 	typedef SmartPointer< Self > Pointer;
> 	typedef SmartPointer< const Self > ConstPointer;
> 	typedef TFeatureImageType FeatureImageType;
> 	
> 
> 	itkNewMacro( Self );
> 	itkTypeMacro( EnhancingLevelSetFunction, SegmentationLevelSetFunction );
> 	typedef typename Superclass::ImageType ImageType;
> 	typedef typename Superclass::ScalarValueType ScalarValueType;
> 	typedef typename Superclass::FeatureScalarType FeatureScalarType;
> 	typedef typename Superclass::RadiusType RadiusType;
> 	typedef typename Superclass::VectorImageType VectorImageType;
> 	typedef typename Superclass::GlobalDataStruct GlobalDataStruct;
> 
> 	
> 	itkStaticConstMacro( ImageDimension, unsigned int, Superclass::ImageDimension
> );
> 
> 	virtual void CalculateSpeedImage();
> 	
> 
> 	virtual void CalculateAdvectionImage();
> 
> 	void CalculateDerivative();
> 	void CalculateCurvatureEnhancing();
> 
> 	void SetAdvectionSpeedTerm(VectorImageType *s)
> 	{
> 		this->SetAdvectionImage( s );
> 	}
> 	virtual void Initialize( const RadiusType &r)
> 	{
> 		Superclass::Initialize(r);
> //		this->SetAdvectionWeight( NumericTraits< ScalarValueType >::Zero );
> //		this->SetPropagationWeight( -1.0*NumericTraits< ScalarValueType >::One );
> //		this->SetCurvatureWeight( NumericTraits< ScalarValueType >::One );
> 
> 	}
> 
> 	/*============= This part is to make any parameter assignments
> 
> 
> 
> 	========================================*/
> 
> protected:
> 
>  	EnhancingLevelSetFunction()
> 	{
> 		
> 		this->SetAdvectionWeight( 0.0 );
> 		this->SetPropagationWeight( 0.0 );
> 		this->SetCurvatureWeight( 1.0 );
> 
> 	}
> 	virtual ~EnhancingLevelSetFunction(){}
> private:
> 	// this structure holds the partial derivatives of the image
> 	struct PD
> 	{
> 		ImageType::Pointer x;// = ImageType::New();
> 		ImageType::Pointer y;// = ImageType::New();
> 		ImageType::Pointer z;// = ImageType::New();
> 		ImageType::Pointer xy;// = ImageType::New();
> 		ImageType::Pointer yz;// = ImageType::New();
> 		ImageType::Pointer xz;// = ImageType::New();
> 		ImageType::Pointer xx;// = ImageType::New();
> 		ImageType::Pointer yy;// = ImageType::New();
> 		ImageType::Pointer zz;// = ImageType::New();
> 
> 	} pd;
> 	float spacing[3];
> 	ImageType::Pointer curvIm;
> 	ImageType::Pointer smoothImage;
> 	ImageType::Pointer unsmoothedSpeedImage;
> 
> };
> }
> 
> #ifndef ITK_MANUAL_INSTANTIATION
> #include "EnhancingLevelSetFunction.cpp"
> #endif
> 
> 
> 
> #endif //
> !defined(AFX_ENHANCINGLEVELSETFUNCTION_H__957ACCF4_DE3C_4A53_AA8D_DF2B59F84FD9__INCLUDED_)
> ////////////////////////////////////////
> 
> 
> And the error message I get is like this:
> c:\Documents and
> Settings\enderk\Desktop\Polyp\Codes\Enhancer\EnhancingLevelSetFunction.h(87) :
> warning C4346:
> 'itk::EnhancingLevelSetFunction<TImageType,TFeatureImageType>::itk::EnhancingLevelSetFunction<TImageType,TFeatureImageType>::ImageType::Pointer'
> : dependent name is not a type
> /////////
> ok you might say that it is not an error but a warning, well it causes every
> other problem.
> 
> 
> Quoting Luis Ibanez <luis.ibanez at kitware.com>:
> 
> 
>>Hi Ender,
>>
>>Visual Studio 6.0 has a very poor support
>>for the "typename" keyword. It basically
>>ignores it when it is present, and do not
>>requires it when the C++ standard says it
>>should be there.
>>
>>Visual Studio 7 fixed those problems and
>>now requires the presence of "typename"
>>as the C++ estandard stablishes. In other
>>words, VC 7.1 is now *almost* as good as
>>GCC. At least regarding "typename"    :-)
>>
>>The fact that your code was compiling ok
>>with VC 6.0 doesn't mean that your code
>>is correct.  VC 7.1 has a much superior
>>compiler at least as far as compliance with
>>the C++ standard goes.
>>
>>Please post to the list the error messages
>>(and associated code snippets) that you get
>>when compiling with Visual Studio 7.1.
>>
>> From those messages we probably will be able
>>to help you find where are you missing "typenames".
>>
>>
>>
>>    Regards,
>>
>>
>>       Luis
>>
>>
>>
>>-----------------------------
>>konukoge at boun.edu.tr wrote:
>>
>>
>>>Hi all,
>>>
>>>I have an interesting problem with vc.net 7.1 2003. I have a c++ code that
>>
>>works
>>
>>>perfectly well when compiled with itk and vc++ 6.0. However when I build
>>
>>ITK
>>
>>>with .net 7.1 , build the program again with this configuration, it gives
>>
>>me
>>
>>>error about typename's. And when I try to build any example of itk with
>>
>>the
>>
>>>latter configuration I have linking errors. Do you know of any problems of
>>
>>ITK
>>
>>>or CMake with .net 7.1
>>>
>>>Thanks a lot
>>>
>>>Ender Konukoglu
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
>>
>>
>>
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 






More information about the Insight-users mailing list