how to use ITK in my own project in visual studio

hi , i’m new in ITK
trying to include ITK in my own project in visual studio 2017
by doing :
1-project->properties->c/c+±>general->Additional Include
2-project->properties->Linker->general->Additional Library
3–project->properties->Linker->Input -> /lib*.lib
and i did these steps in both debug and release modes …then i tried to run simple program …and this error shows up :upside_down_face:

Severity Code Description Project File Line Suppression State
Error C4996 ‘std::copy::_Unchecked_iterators::_Deprecate’: Call to ‘std::copy’ 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’ Prostate c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.13.26128\include\xutility 2440

my code :

#include “itkImage.h”
using namespace std;
int main()

typedef itk::Image< unsigned short, 3 > ImageType;
ImageType::Pointer image = ImageType::New();
std::cout << "ITK Hello World !" << std::endl;
return 0;


I haven’t yet been able to reproduce this issue, but I’m afraid this kind of warning cannot be entirely avoided. However, it can be suppressed, in various ways:

  • Switch off C/C++ -> General -> Treat Warnings As Errors
  • Add _SCL_SECURE_NO_WARNINGS to C/C++ -> Preprocessor Definitions
  • Add #pragma warning(disable: 4996) to your cpp file (before doing the #include directives)

One of these should be sufficient to get your project building… right?

@maioda it is recommended to configure your project with CMake. This helps populate the required build settings in the Visual Studio project file.