0
votes

I am trying to build itk, however when I try to use sample programs I get the following error:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2761): warning C4996: 'std::_Fill_n': 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' 2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2747) : see declaration of 'std::_Fill_n'

or an error like this:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2176): 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' 2> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2157) : see declaration of 'std::_Copy_impl' 2> c:\users\ayelet\downloads\insighttoolkit-4.8.0\modules\core\common\include\itkImportImageContainer.hxx(72) : see reference to function template instantiation '_OutIt std::copy(_InIt,_InIt,_OutIt)' being compiled

basically there seems to be a problem with checked iterators.I lloked up what checked iterators are and eventually got to this link:https://msdn.microsoft.com/en-us/library/hh697468(v=vs.110).aspx. I tried using define ITERATOR_DEBUG_LEVEL in the actual programs but that didn't help. I tried compiling the itk libraries with ITERATOR_DEBUG_LEVEL=2 and the sample program. To do this I wrote /D_ITERATOR_DEBUG_LEVEL=2 in cmake_cxx_flags and cmake_c_flags in the cmake-gui. I am still getting the same error.

I thought of trying to stick _ITERATOR_DEBUG_LEVEL somewhere in the itk cmakelists but the whole structure seems so complex so I wouldn't know where to put it.

I'm not sure if my syntax in cmake-gui is correct because I couldn't find a single example of setting an option to a specific value in cmake-gui so I don't know if "=" is the correct syntax.(I could only find setting options - like /DWIN32) Than again there could be something else that I'm doing wrong - I just don't know.

Anyone have an idea of what I can do?

1

1 Answers

0
votes

Often this kind of messages come from mixing up Release/Debug libraries and executables and it's not necessary to set the _ITERATOR_DEBUG_LEVEL manually.

I suppose you built ITK both in Debug and Release version (by selecting the drop-down in the Visual Studio menu). Is it possible that you installed both the version in the same folder? In this case the second one has overwritten the first one (unfortunately the ITK debug libraries don't have the a _d suffix in the name , they have to be in a different folders from the release libraries).

In your sample program, when you run cmake and you are asked for itk directory, put the itk build directory (instead of the install directory). To be really sure of what is going on, you can temporarily move the folder with the version you don't want to be included.