使用ITK库的错误和警告

时间:2015-07-23 14:44:36

标签: c++ visual-studio-2012 itk

我正在尝试在我自己的项目中使用itk库。 我使用cmake 3.3构建了ITK,并使用cmake来配置我自己的项目。 但是,当我尝试使用Visual Studio 2012构建项目时,我收到以下警告(在调试模式下):

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:\work\myproject\thirdparty\modules\io\imagebase\include\itkImageFileReader.hxx(441) : see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned char*>(_InIt,_InIt,_OutIt)' being compiled
2>          with
2>          [
2>              _OutIt=unsigned char *,
2>              _InIt=const unsigned char *
2>          ]
2>          c:\work\myproject\thirdparty\modules\io\imagebase\include\itkImageFileReader.hxx(353) : while compiling class template member function 'void itk::ImageFileReader<TOutputImage>::GenerateData(void)'
2>          with
2>          [
2>              TOutputImage=ImageType
2>          ]
2>          C:\Work\myproject\Main.cpp(77) : see reference to class template instantiation 'itk::ImageFileReader<TOutputImage>' being compiled
2>          with
2>          [
2>              TOutputImage=ImageType
2>          ]
2>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xutility(2157) : see declaration of 'std::_Copy_impl'

(之后有关于pdb文件没有出现的警告)

当我运行exe时,我在reader-&gt; Update()中得到一个例外;在我的文件中(稍后出现在我的问题中)

这是我的CMakeLists.txt文件:

project(myproj)
 SET( EX_PLATFORM 64 )
 SET( EX_PLATFORM_NAME "x64" )
cmake_minimum_required(VERSION 2.6.0)
include_directories ("thirdParty/Modules/Segmentation/Watersheds/include"
                 "thirdParty/Modules/Segmentation/Voronoi/include"
                 "thirdParty/Modules/Video/IO/include"
                 "thirdParty/Modules/Video/Filtering/include"
                 "thirdParty/Modules/Video/Core/include"
                 "thirdParty/Modules/Bridge/VTK/include"
                 "thirdParty/Modules/Core/TestKernel/include"
                 "thirdParty/Modules/Filtering/SpatialFunction/include"
                 "thirdParty/Modules/Registration/RegistrationMethodsv4/include"
                 "thirdParty/Modules/Segmentation/RegionGrowing/include"
                 "thirdParty/Modules/Filtering/QuadEdgeMeshFiltering/include"
                 "thirdParty/Modules/Numerics/NeuralNetworks/include"
                 "thirdParty/Modules/Registration/Metricsv4/include"
                 "thirdParty/Modules/Numerics/Optimizersv4/include"
                 "thirdParty/Modules/Segmentation/MarkovRandomFieldsClassifiers/include"
                 "thirdParty/Modules/Segmentation/LevelSetsv4/include"
                 "thirdParty/Modules/Segmentation/LabelVoting/include"
                 "thirdParty/Modules/Segmentation/KLMRegionGrowing/include"
                 "thirdParty/Modules/Filtering/ImageNoise/include"
                 "thirdParty/Modules/Filtering/ImageFusion/include"
                 "thirdParty/Modules/IO/VTK/include"
                 "thirdParty/Modules/IO/TransformMatlab/include"
                 "thirdParty/Modules/IO/TransformInsightLegacy/include"
                 "thirdParty/Modules/IO/TransformHDF5/include"
                 "thirdParty/Modules/IO/TransformBase/include"
                 "thirdParty/Modules/IO/Stimulate/include"
                 "thirdParty/Modules/IO/Siemens/include"
                 "thirdParty/Modules/IO/RAW/include"
                 "thirdParty/Modules/IO/PNG/include"
                 "thirdParty/Modules/ThirdParty/PNG/src"
                 "thirdParty/itk_target/Modules/ThirdParty/PNG/src"
                 "thirdParty/Modules/IO/NRRD/include"
                 "thirdParty/Modules/ThirdParty/NrrdIO/src/NrrdIO"
                 "thirdParty/itk_target/Modules/ThirdParty/NrrdIO/src/NrrdIO"
                 "thirdParty/Modules/IO/NIFTI/include"
                  "thirdParty/Modules/IO/Meta/include"
                 "thirdParty/Modules/IO/Mesh/include"
                 "thirdParty/Modules/IO/MRC/include"
                 "thirdParty/Modules/IO/LSM/include"
                 "thirdParty/Modules/IO/TIFF/include"
                 "thirdParty/Modules/ThirdParty/TIFF/src"
                 "thirdParty/itk_target/Modules/ThirdParty/TIFF/src/itktiff"
                 "thirdParty/itk_target/Modules/ThirdParty/TIFF/src"
                 "thirdParty/Modules/IO/JPEG/include"
                 "thirdParty/Modules/ThirdParty/JPEG/src"
                 "thirdParty/itk_target/Modules/ThirdParty/JPEG/src"
                 "thirdParty/Modules/IO/HDF5/include"
                 "thirdParty/Modules/IO/GIPL/include"
                 "thirdParty/Modules/IO/GE/include"
                 "thirdParty/Modules/IO/IPL/include"
                 "thirdParty/Modules/IO/GDCM/include"
                 "thirdParty/Modules/IO/CSV/include"
                 "thirdParty/Modules/IO/BioRad/include"
                 "thirdParty/Modules/IO/BMP/include"
                 "thirdPartyitk_target/Modules/ThirdParty/HDF5/src"
                 "thirdParty/Modules/ThirdParty/HDF5/src"
                 "thirdParty/Modules/Filtering/GPUThresholding/include"
                 "thirdParty/Modules/Filtering/GPUSmoothing/include"
                 "thirdParty/Modules/Registration/GPUPDEDeformable/include"
                 "thirdParty/Modules/Registration/GPUCommon/include"
                 "thirdParty/Modules/Filtering/GPUImageFilterBase/include"
                 "thirdParty/Modules/Filtering/GPUAnisotropicSmoothing/include"
                 "thirdParty/Modules/Core/GPUFiniteDifference/include"
                 "thirdParty/Modules/Core/GPUCommon/include"
                 "thirdParty/Modules/ThirdParty/GIFTI/src/gifticlib"
                 "thirdParty/Modules/ThirdParty/NIFTI/src/nifti/znzlib"
                 "thirdParty/Modules/ThirdParty/NIFTI/src/nifti/niftilib"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDefinition"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/Common"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary"
                 "thirdParty/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat"
                 "thirdParty/itk_target/Modules/ThirdParty/GDCM/src/gdcm/Source/Common"
                 "thirdParty/itk_target/Modules/ThirdParty/GDCM"
                 "thirdParty/Modules/Registration/FEM/include"
                 "thirdParty/Modules/Registration/PDEDeformable/include"
                 "thirdParty/Modules/Numerics/FEM/include"
                 "thirdParty/Modules/Registration/Common/include"
                 "thirdParty/Modules/IO/SpatialObjects/include"
                 "thirdParty/Modules/IO/XML/include"
                 "thirdParty/Modules/ThirdParty/Expat/src/expat"
                 "thirdParty/itk_target/Modules/ThirdParty/Expat/src/expat"
                 "thirdParty/Modules/Numerics/Eigen/include"
                 "thirdParty/Modules/Filtering/DisplacementField/include"
                 "thirdParty/Modules/Filtering/DiffusionTensorImage/include"
                 "thirdParty/Modules/Filtering/Denoising/include"
                 "thirdParty/Modules/Segmentation/DeformableMesh/include"
                 "thirdParty/Modules/Filtering/Deconvolution/include"
                 "thirdParty/Modules/ThirdParty/DICOMParser/src/DICOMParser"
                 "thirdParty/itk_target/Modules/ThirdParty/DICOMParser/src/DICOMParser"
                 "thirdParty/Modules/Filtering/Convolution/include"
                 "thirdParty/Modules/Filtering/FFT/include"
                 "thirdParty/Modules/Filtering/Colormap/include"
                 "thirdParty/Modules/Segmentation/Classifiers/include"
                 "thirdParty/Modules/Segmentation/BioCell/include"
                 "thirdParty/Modules/Filtering/BiasCorrection/include"
                 "thirdParty/Modules/Numerics/Polynomials/include"
                 "thirdParty/Modules/Filtering/AntiAlias/include"
                 "thirdParty/Modules/Segmentation/LevelSets/include"
                 "thirdParty/Modules/Segmentation/SignedDistanceFunction/include"
                 "thirdParty/Modules/Numerics/Optimizers/include"
                 "thirdParty/Modules/Filtering/ImageFeature/include"
                 "thirdParty/Modules/Filtering/ImageSources/include"
                 "thirdParty/Modules/Filtering/ImageGradient/include"
                 "thirdParty/Modules/Filtering/Smoothing/include"
                 "thirdParty/Modules/Filtering/ImageCompare/include"
                 "thirdParty/Modules/Filtering/FastMarching/include"
                 "thirdParty/Modules/Core/QuadEdgeMesh/include"
                 "thirdParty/Modules/Filtering/DistanceMap/include"
                 "thirdParty/Modules/Numerics/NarrowBand/include"
                 "thirdParty/Modules/Filtering/BinaryMathematicalMorphology/include"
                 "thirdParty/Modules/Filtering/LabelMap/include"
                 "thirdParty/Modules/Filtering/MathematicalMorphology/include"
                 "thirdParty/Modules/Segmentation/ConnectedComponents/include"
                 "thirdParty/Modules/Filtering/Thresholding/include"
                 "thirdParty/Modules/Filtering/ImageLabel/include"
                 "thirdParty/Modules/Filtering/ImageIntensity/include"
                 "thirdParty/Modules/Filtering/Path/include"
                 "thirdParty/Modules/Filtering/ImageStatistics/include"
                 "thirdParty/Modules/Core/SpatialObjects/include"
                 "thirdParty/Modules/ThirdParty/MetaIO/src/MetaIO/src"
                 "thirdParty/itk_target/Modules/ThirdParty/MetaIO/src/MetaIO/src"
                 "thirdParty/Modules/ThirdParty/ZLIB/src"
                 "thirdParty/itk_target/Modules/ThirdParty/ZLIB/src"
                 "thirdParty/Modules/Core/Mesh/include"
                 "thirdParty/Modules/IO/ImageBase/include"
                 "thirdParty/itk_target/Modules/IO/ImageBase"
                 "thirdParty/Modules/Filtering/ImageCompose/include"
                 "thirdParty/Modules/Filtering/AnisotropicSmoothing/include"
                 "thirdParty/Modules/Filtering/ImageGrid/include"
                 "thirdParty/Modules/Core/ImageFunction/include"
                 "thirdParty/Modules/Core/Transform/include"
                 "thirdParty/Modules/Numerics/Statistics/include"
                 "thirdParty/itk_target/Modules/ThirdParty/Netlib"
                 "thirdParty/Modules/Core/ImageAdaptors/include"
                 "thirdParty/Modules/Filtering/CurvatureFlow/include"
                 "thirdParty/Modules/Filtering/ImageFilterBase/include"
                 "thirdParty/Modules/Core/FiniteDifference/include"
                 "thirdParty/Modules/Core/Common/include"
                "thirdParty/itk_target/Modules/Core/Common"
                 "thirdParty/Modules/ThirdParty/VNLInstantiation/include"
                 "thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/core"
                 "thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/vcl"
                 "thirdParty/itk_target/Modules/ThirdParty/VNL/src/vxl/v3p/netlib"
                 "thirdParty/Modules/ThirdParty/VNL/src/vxl/core"
                 "thirdParty/Modules/ThirdParty/VNL/src/vxl/vcl"
                 "thirdParty/Modules/ThirdParty/VNL/src/vxl/v3p/netlib"
                 "thirdParty/itk_target/Modules/ThirdParty/KWSys/src"
                "thirdParty/itk_target/Modules/ThirdParty/DoubleConversion/src/double-conversion"
                 "thirdParty/Modules/ThirdParty/DoubleConversion/src/double-conversion"
                 "thirdParty/Modules/ThirdParty/VNL/src/vxl/vcl/emulation"
                 )
SET(DEBUG_DIR  "../thirdParty/lib/Debug/")
SET(RELEASE_DIR "../thirdParty/lib/Release/")


SET(Sources "Main.cpp")


add_executable(myproj  ${Sources})

target_link_libraries(myproj 
                debug "${DEBUG_DIR}DeformableRegistration11"
                debug "${DEBUG_DIR}DeformableRegistration11"
                debug "${DEBUG_DIR}ITKBiasCorrection-4.8"
                debug "${DEBUG_DIR}ITKBioCell-4.8"
                debug "${DEBUG_DIR}ITKCommon-4.8"
                debug "${DEBUG_DIR}ITKDICOMParser-4.8"
                debug "${DEBUG_DIR}itkdouble-conversion-4.8"
                debug "${DEBUG_DIR}ITKEXPAT-4.8"
                debug "${DEBUG_DIR}ITKFEM-4.8"
                debug "${DEBUG_DIR}itkgdcmcharls-4.8"
                debug "${DEBUG_DIR}itkgdcmCommon-4.8"
                debug "${DEBUG_DIR}itkgdcmDICT-4.8"
                debug "${DEBUG_DIR}itkgdcmDSED-4.8"
                debug "${DEBUG_DIR}itkgdcmIOD-4.8"
                debug "${DEBUG_DIR}itkgdcmjpeg12-4.8"
                debug "${DEBUG_DIR}itkgdcmjpeg16-4.8"
                debug "${DEBUG_DIR}itkgdcmjpeg8-4.8"
                debug "${DEBUG_DIR}itkgdcmMEXD-4.8"
                debug "${DEBUG_DIR}itkgdcmMSFF-4.8"
                debug "${DEBUG_DIR}itkgdcmopenjpeg-4.8"
                debug "${DEBUG_DIR}itkgdcmsocketxx-4.8"
                debug "${DEBUG_DIR}ITKgiftiio-4.8"
                debug "${DEBUG_DIR}itkhdf5-4.8"
                debug "${DEBUG_DIR}itkhdf5_cpp-4.8"
                debug "${DEBUG_DIR}ITKIOBioRad-4.8"
                debug "${DEBUG_DIR}ITKIOBMP-4.8"
                debug "${DEBUG_DIR}ITKIOCSV-4.8"
                debug "${DEBUG_DIR}ITKIOGDCM-4.8"
                debug "${DEBUG_DIR}ITKIOGE-4.8"
                debug "${DEBUG_DIR}ITKIOGIPL-4.8"
                debug "${DEBUG_DIR}ITKIOHDF5-4.8"
                debug "${DEBUG_DIR}ITKIOImageBase-4.8"
                debug "${DEBUG_DIR}ITKIOIPL-4.8"
                debug "${DEBUG_DIR}ITKIOJPEG-4.8"
                debug "${DEBUG_DIR}ITKIOLSM-4.8"
                debug "${DEBUG_DIR}ITKIOMesh-4.8"
                debug "${DEBUG_DIR}ITKIOMeta-4.8"
                debug "${DEBUG_DIR}ITKIOMRC-4.8"
                debug "${DEBUG_DIR}ITKIONIFTI-4.8"
                debug "${DEBUG_DIR}ITKIONRRD-4.8"
                debug "${DEBUG_DIR}ITKIOPNG-4.8"
                debug "${DEBUG_DIR}ITKIOSiemens-4.8"
                debug "${DEBUG_DIR}ITKIOSpatialObjects-4.8"
                debug "${DEBUG_DIR}ITKIOStimulate-4.8"
                debug "${DEBUG_DIR}ITKIOTIFF-4.8"
                debug "${DEBUG_DIR}ITKIOTransformBase-4.8"
                debug "${DEBUG_DIR}ITKIOTransformHDF5-4.8"
                debug "${DEBUG_DIR}ITKIOTransformInsightLegacy-4.8"
                debug "${DEBUG_DIR}ITKIOTransformMatlab-4.8"
                debug "${DEBUG_DIR}ITKIOVTK-4.8"
                debug "${DEBUG_DIR}ITKIOXML-4.8"
                debug "${DEBUG_DIR}itkjpeg-4.8"
                debug "${DEBUG_DIR}ITKKLMRegionGrowing-4.8"
                debug "${DEBUG_DIR}ITKLabelMap-4.8"
                debug "${DEBUG_DIR}ITKMesh-4.8"
                debug "${DEBUG_DIR}ITKMetaIO-4.8"
                debug "${DEBUG_DIR}itkNetlibSlatec-4.8"
                debug "${DEBUG_DIR}ITKniftiio-4.8"
                debug "${DEBUG_DIR}ITKNrrdIO-4.8"
                debug "${DEBUG_DIR}ITKOptimizers-4.8"
                debug "${DEBUG_DIR}ITKOptimizersv4-4.8"
                debug "${DEBUG_DIR}ITKPath-4.8"
                debug "${DEBUG_DIR}itkpng-4.8"
                debug "${DEBUG_DIR}ITKPolynomials-4.8"
                debug "${DEBUG_DIR}ITKQuadEdgeMesh-4.8"
                debug "${DEBUG_DIR}ITKSpatialObjects-4.8"
                debug "${DEBUG_DIR}ITKStatistics-4.8"
                debug "${DEBUG_DIR}itksys-4.8"
                debug "${DEBUG_DIR}itktestlib-4.8"
                debug "${DEBUG_DIR}itktiff-4.8"
                debug "${DEBUG_DIR}itkv3p_lsqr-4.8"
                debug "${DEBUG_DIR}itkv3p_netlib-4.8"
                debug "${DEBUG_DIR}itkvcl-4.8"
                debug "${DEBUG_DIR}ITKVideoCore-4.8"
                debug "${DEBUG_DIR}ITKVideoIO-4.8"
                debug "${DEBUG_DIR}itkvnl-4.8"
                debug "${DEBUG_DIR}ITKVNLInstantiation-4.8"
                debug "${DEBUG_DIR}itkvnl_algo-4.8"
                debug "${DEBUG_DIR}ITKVTK-4.8"
                debug "${DEBUG_DIR}ITKWatersheds-4.8"
                debug "${DEBUG_DIR}itkzlib-4.8"
                debug "${DEBUG_DIR}ITKznz-4.8"
                debug "${DEBUG_DIR}DeformableRegistration1"

                optimized "${RELEASE_DIR}DeformableRegistration11"
                optimized "${RELEASE_DIR}DeformableRegistration11"
                optimized "${RELEASE_DIR}ITKBiasCorrection-4.8"
                optimized "${RELEASE_DIR}ITKBioCell-4.8"
                optimized "${RELEASE_DIR}ITKCommon-4.8"
                optimized "${RELEASE_DIR}ITKDICOMParser-4.8"
                optimized "${RELEASE_DIR}itkdouble-conversion-4.8"
                optimized "${RELEASE_DIR}ITKEXPAT-4.8"
                optimized "${RELEASE_DIR}ITKFEM-4.8"
                optimized "${RELEASE_DIR}itkgdcmcharls-4.8"
                optimized "${RELEASE_DIR}itkgdcmCommon-4.8"
                optimized "${RELEASE_DIR}itkgdcmDICT-4.8"
                optimized "${RELEASE_DIR}itkgdcmDSED-4.8"
                optimized "${RELEASE_DIR}itkgdcmIOD-4.8"
                optimized "${RELEASE_DIR}itkgdcmjpeg12-4.8"
                optimized "${RELEASE_DIR}itkgdcmjpeg16-4.8"
                optimized "${RELEASE_DIR}itkgdcmjpeg8-4.8"
                optimized "${RELEASE_DIR}itkgdcmMEXD-4.8"
                optimized "${RELEASE_DIR}itkgdcmMSFF-4.8"
                optimized "${RELEASE_DIR}itkgdcmopenjpeg-4.8"
                optimized "${RELEASE_DIR}itkgdcmsocketxx-4.8"
                optimized "${RELEASE_DIR}ITKgiftiio-4.8"
                optimized "${RELEASE_DIR}itkhdf5-4.8"
                optimized "${RELEASE_DIR}itkhdf5_cpp-4.8"
                optimized "${RELEASE_DIR}ITKIOBioRad-4.8"
                optimized "${RELEASE_DIR}ITKIOBMP-4.8"
                optimized "${RELEASE_DIR}ITKIOCSV-4.8"
                optimized "${RELEASE_DIR}ITKIOGDCM-4.8"
                optimized "${RELEASE_DIR}ITKIOGE-4.8"
                optimized "${RELEASE_DIR}ITKIOGIPL-4.8"
                optimized "${RELEASE_DIR}ITKIOHDF5-4.8"
                optimized "${RELEASE_DIR}ITKIOImageBase-4.8"
                optimized "${RELEASE_DIR}ITKIOIPL-4.8"
                optimized "${RELEASE_DIR}ITKIOJPEG-4.8"
                optimized "${RELEASE_DIR}ITKIOLSM-4.8"
                optimized "${RELEASE_DIR}ITKIOMesh-4.8"
                optimized "${RELEASE_DIR}ITKIOMeta-4.8"
                optimized "${RELEASE_DIR}ITKIOMRC-4.8"
                optimized "${RELEASE_DIR}ITKIONIFTI-4.8"
                optimized "${RELEASE_DIR}ITKIONRRD-4.8"
                optimized "${RELEASE_DIR}ITKIOPNG-4.8"
                optimized "${RELEASE_DIR}ITKIOSiemens-4.8"
                optimized "${RELEASE_DIR}ITKIOSpatialObjects-4.8"
                optimized "${RELEASE_DIR}ITKIOStimulate-4.8"
                optimized "${RELEASE_DIR}ITKIOTIFF-4.8"
                optimized "${RELEASE_DIR}ITKIOTransformBase-4.8"
                optimized "${RELEASE_DIR}ITKIOTransformHDF5-4.8"
                optimized "${RELEASE_DIR}ITKIOTransformInsightLegacy-4.8"
                optimized "${RELEASE_DIR}ITKIOTransformMatlab-4.8"
                optimized "${RELEASE_DIR}ITKIOVTK-4.8"
                optimized "${RELEASE_DIR}ITKIOXML-4.8"
                optimized "${RELEASE_DIR}itkjpeg-4.8"
                optimized "${RELEASE_DIR}ITKKLMRegionGrowing-4.8"
                optimized "${RELEASE_DIR}ITKLabelMap-4.8"
                optimized "${RELEASE_DIR}ITKMesh-4.8"
                optimized "${RELEASE_DIR}ITKMetaIO-4.8"
                optimized "${RELEASE_DIR}itkNetlibSlatec-4.8"
                optimized "${RELEASE_DIR}ITKniftiio-4.8"
                optimized "${RELEASE_DIR}ITKNrrdIO-4.8"
                optimized "${RELEASE_DIR}ITKOptimizers-4.8"
                optimized "${RELEASE_DIR}ITKOptimizersv4-4.8"
                optimized "${RELEASE_DIR}ITKPath-4.8"
                optimized "${RELEASE_DIR}itkpng-4.8"
                optimized "${RELEASE_DIR}ITKPolynomials-4.8"
                optimized "${RELEASE_DIR}ITKQuadEdgeMesh-4.8"
                optimized "${RELEASE_DIR}ITKSpatialObjects-4.8"
                optimized "${RELEASE_DIR}ITKStatistics-4.8"
                optimized "${RELEASE_DIR}itksys-4.8"
                optimized "${RELEASE_DIR}itktestlib-4.8"
                optimized "${RELEASE_DIR}itktiff-4.8"
                optimized "${RELEASE_DIR}itkv3p_lsqr-4.8"
                optimized "${RELEASE_DIR}itkv3p_netlib-4.8"
                optimized "${RELEASE_DIR}itkvcl-4.8"
                optimized "${RELEASE_DIR}ITKVideoCore-4.8"
                optimized "${RELEASE_DIR}ITKVideoIO-4.8"
                optimized "${RELEASE_DIR}itkvnl-4.8"
                optimized "${RELEASE_DIR}ITKVNLInstantiation-4.8"
                optimized "${RELEASE_DIR}itkvnl_algo-4.8"
                optimized "${RELEASE_DIR}ITKVTK-4.8"
                optimized "${RELEASE_DIR}ITKWatersheds-4.8"
                optimized "${RELEASE_DIR}itkzlib-4.8"
                optimized "${RELEASE_DIR}ITKznz-4.8"
                optimized "${RELEASE_DIR}DeformableRegistration1"


                )

这是我用来运行cmake的运行文件

cd build 
cmake -G "Visual Studio 11 2012 Win64" ..
cd ..

这是我的cpp文件,它是(减去评论)

中找到的示例的副本
#include "itkImage.h"
#include "itkImageFileReader.h"

int main( int , char * argv[])
{
  typedef unsigned char          PixelType;
  const unsigned int             Dimension = 3;
  typedef itk::Image< PixelType, Dimension >   ImageType;  
  typedef itk::ImageFileReader< ImageType >  ReaderType; 
  ReaderType::Pointer reader = ReaderType::New(); 
  const char * filename = argv[1];
  reader->SetFileName( filename ); 
  reader->Update();
  ImageType::Pointer image = reader->GetOutput();
  return EXIT_SUCCESS;
}

当我使用cmake运行示例时,所有内容都构建并运行正常,因此问题可能在于我的cmakeLists。 我已经尝试查看所有itk cmake文件,但我无法确定应该使用哪些配置。 我尝试使用#define SCL_SECURE_NO_WARNINGS(根据  http://public.kitware.com/pipermail/insight-users/2010-September/037992.html)但这并没有帮助。 我想使用#define _SECURE_SCL 0来允许检查迭代器,但是因为我在RelWithDebInfo模式中得到异常,所以我认为它不会有用。 任何人都知道我还能尝试什么/我有什么错误?

编辑:问题似乎与我的cmakelists没有关系,因为当我尝试构建&#34; HelloWorldInsight&#34; project(它是hello world项目)我得到了相同的检查迭代器警告。

1 个答案:

答案 0 :(得分:1)

使用

保持您的CMakeLists.txt文件简单
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

无论如何,移动ITK的内置版本并不是那么简单,您不应移动构建目录,而是创建安装目录。 简而言之,你应该:

    cmakegui中的
  • ,将cmake_install前缀设置为您有权编写的某个文件夹(不是默认的C:/ Program Files)
  • 设置cmake gui中的其他选项,在Visual Studio中打开ITK.sln并构建
  • 从Visual Studio中选择ITK.sln中的项目INSTALL和&#34;仅构建此项目&#34;。在输出中,您将看到一堆文件被复制
  • 您必须决定是否要安装调试库或发行库,而不能将它们安装在同一个文件夹中,因为它们具有相同的名称并且会被覆盖。

有关精彩的屏幕截图,请参阅https://stackoverflow.com/a/26286268/1136458

的第一步