Running HelloWorld example of itk in Visual Studio 2013

好久不见. 提交于 2019-12-11 04:49:45

问题


I have installed itk on my system using the answer in this link.

So, I have bin, include, lib, share sub-folders in C:\Program Files (x86)\ITK.

(Small question : does bin sub-folder only have "itkTestDriver.exe" file?)

Now, I am trying to run HelloWorld example. I have created a project which consists of HelloWorld.cpp.

#include "stdafx.h"
#include "itkImage.h"
#include <iostream>

int main() {    typedef itk::Image< unsigned short, 3 > ImageType;

    ImageType::Pointer image = ImageType::New();

    std::cout << "ITK Hello World !" << std::endl;  std::cin;

    return 0; }

I have never used external libraries, so I searched on internet and I did the followings :

  • In Projects->properties->linker->input->additional dependencies : kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;C:\Program Files (x86)\ITK\lib\ITKCommon-4.6.lib;%(AdditionalDependencies)
  • Projects->properties->linker->general->additional library directories : C:\Program Files (x86)\ITK\include\

However, I still have problem and I can not build my program due to fatal error of not finding a header file.

I have also tried to copy all of the header files in ITK\include\ to my project's directory, but I still have the same error for other files.

I would be thankful if someone kindly help me with this problem.


UPDATE:

I did the followings:

  • Projects->properties->linker->input->additional dependencies : I added C:\Program Files (x86)\ITK\lib*.lib;

  • Projects->properties-> C/C++-> additional include directories : I added C:\Program Files (x86)\ITK\include\ITK-4.6;

Then, I was getting this error:

Error 1 error 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' i:\microsoft visual studio 12.0\vc\include\xutility 2132 1 ConsoleApplication1

I fixed it by disabling the warning:

  • In "Projects->properties-> C/C++ -> Advanced -> Disable Specific Warnings ->" I added "4996".

来源:https://stackoverflow.com/questions/26739488/running-helloworld-example-of-itk-in-visual-studio-2013

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!