[Insight-developers] more VC++ idiosyncrasies
Lydia Ng
lng@statsci.com
Fri, 1 Dec 2000 19:10:35 -0800
Hi,
I get an error when I try to compile itkImportImageTest.cxx in VC++.
It complains about the redefinition of the loop variable i in
line 90 of itkShrinkImage.txx. The error message is attached below.
This is yet another C++ standard noncompliance problem,
worst still it happens intermittently as there is lots of other code
where the loop variable has been used more than once.
They have a fix in:
http://support.microsoft.com/support/kb/articles/Q167/7/48.ASP
where they suggest to either:
a) set compiler option /Za
This causes more compile errors.
b) #defining the "for" keyword as follows:
#define for if(0); else for
The #defining seems to work.
If this is the only solution, we probably need to stick it
in some VC++ related makefile.
BTW, when I run itkImportImageTest in Release mode (after adding the
#define) I get an
access violation due to the CopyInformation() problem.
Running itkImportImageTest on Cygwin also results in an access violation
- but I haven't stepped through it to see if it the same problem.
Lydia
--------------------Configuration: itkImportImageTest - Win32
Release--------------------
Compiling...
itkImportImageTest.cxx
F:\lng\projects\Insight-clean\Insight/Code/Common\itkMultiThreader.h(233) :
warning C4251: 'm_SpawnedThreadActiveFlagLock' : class
'itk::SmartPointer<class itk::MutexLock>' needs to have dll-interface to be
used by clients of class 'itk::MultiThread
er'
F:\lng\projects\Insight-clean\Insight/Code/Common\itkProcessObject.h(342) :
warning C4251: 'm_Inputs' : class 'std::vector<class itk::SmartPointer<class
itk::DataObject>,class std::allocator<class itk::SmartPointer<class
itk::DataObject> > >' needs
to have dll-interface to be used by clients of class 'itk::ProcessObject'
F:\lng\projects\Insight-clean\Insight/Code/Common\itkProcessObject.h(348) :
warning C4251: 'm_Outputs' : class 'std::vector<class
itk::SmartPointer<class itk::DataObject>,class std::allocator<class
itk::SmartPointer<class itk::DataObject> > >' needs
to have dll-interface to be used by clients of class 'itk::ProcessObject'
F:\lng\projects\Insight-clean\Insight/Code/Common\itkProcessObject.h(371) :
warning C4251: 'm_Threader' : class 'itk::SmartPointer<class
itk::MultiThreader>' needs to have dll-interface to be used by clients of
class 'itk::ProcessObject'
F:\lng\projects\Insight-clean\Insight/Code/Common\itkShrinkImage.txx(90) :
error C2374: 'i' : redefinition; multiple initialization
F:\lng\projects\Insight-clean\Insight/Code/Common\itkShrinkImage.txx(76) :
see declaration of 'i'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(583) :
while compiling class-template member function 'void __thiscall
itk::ShrinkImage<class itk::Image<short,2,class
itk::ImportImageContainer<unsigned long,short> >,class itk::
Image<class itk::Scalar<short>,2,class itk::ValarrayImageContainer<unsigned
long,class itk::Scalar<short> > > >::ThreadedGenerateData(const class
itk::ImageRegion<2> &,int)'
Error executing cl.exe.
itkImportImageTest.exe - 1 error(s), 4 warning(s)