[Insight-developers] std::_Copy_impl warning when building against ITK with MSVC 2010

David Doria daviddoria at gmail.com
Sun Sep 16 09:52:32 EDT 2012


When I build even something very very simple like this with the MSVC
2010 compiler:

#include "itkImage.h"
#include "itkImageFileReader.h"

int main(int argc, char *argv[])
{
  typedef itk::Image< double, 2 >         ImageType;
  typedef itk::ImageFileReader<ImageType> ReaderType;

  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName(argv[1]);
  reader->Update();

  return EXIT_SUCCESS;
}


I get:

----------------------
C:\Program Files\Microsoft Visual Studio
10.0\VC\INCLUDE\xutility:2227: warning: C4996: 'std::_Copy_impl':
Function call with parameters that may be unsafe - this call relies on
the caller to check that the passed values are correct. To disable
this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how
to use Visual C++ 'Checked Iterators'

C:\Program Files\Microsoft Visual Studio
10.0\VC\INCLUDE\xutility:2212: see declaration of 'std::_Copy_impl'

c:\src\itk\modules\io\imagebase\include\itkImageFileReader.hxx:440:
see reference to function template instantiation '_OutIt
std::copy<const double*,double*>(_InIt,_InIt,_OutIt)' being compiled
with
[
    _OutIt=double *,
    _InIt=const double *
]

c:\src\itk\modules\io\imagebase\include\itkImageFileReader.hxx:353:
while compiling class template member function 'void
itk::ImageFileReader<TOutputImage>::GenerateData(void)'
with
[
    TOutputImage=ImageType
]

C:\src\TestITK\TestITK.cxx:9: see reference to class template
instantiation 'itk::ImageFileReader<TOutputImage>' being compiled
with
[
    TOutputImage=ImageType
]
----------------------

Has anyone seen this? Is this D_SCL_SECURE_NO_WARNINGS something that
should be added to ITKSetStandardCompilerFlags.cmake? Or is there a
better explanation?

Thanks,

David


More information about the Insight-developers mailing list