ITK itkImageFileReader.h导致链接错误

时间:2016-09-30 19:28:40

标签: c++ cmake qt-creator itk msvc12

我已经使用CMAKE和Visual Studio 2013构建了ITK 4.10,但我在QtCreator上使用它。我已关注此链接to write the .pro file。除了一点之外,它的效果很好。当我包含itkImageFileReader.h时,我得到11个LNK2019错误(其他.h文件没有问题)。 这里有一些rapscallions:

itksys-4.10.lib(SystemTools.obj):-1: erreur : LNK2019: unresolved external symbol __imp_OpenProcessToken referenced in function "bool __cdecl itksys::DeleteJunction(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?DeleteJunction@itksys@@YA_NAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)

itksys-4.10.lib(SystemTools.obj):-1: erreur : LNK2019: unresolved external symbol __imp_AdjustTokenPrivileges referenced in function "bool __cdecl itksys::DeleteJunction(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?DeleteJunction@itksys@@YA_NAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z)

itksys-4.10.lib(EncodingCXX.obj):-1: erreur : LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function "public: static class itksys::Encoding::CommandLineArguments __cdecl itksys::Encoding::CommandLineArguments::Main(int,char const * const *)" (?Main@CommandLineArguments@Encoding@itksys@@SA?AV123@HPEBQEBD@Z)

找不到itksys-4.10.lib(SystemTools.obj)和(EncodingCXX.obj)。

这是.pro文件:

QT += core
QT -= gui

CONFIG += c++11
TARGET = itkTest

CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

INCLUDEPATH += C:/InsightToolkit-4.10.0/include/ITK-4.10

LIBS += -LC:/InsightToolkit-4.10.0/build/lib/Release
LIBS += "C:/InsightToolkit-4.10.0/build/lib/Release/ITKBiasCorrection-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKBioCell-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKCommon-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKDICOMParser-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkdouble-conversion-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKEXPAT-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKFEM-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmcharls-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmCommon-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmDICT-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmDSED-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmIOD-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmjpeg8-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmjpeg12-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmjpeg16-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmMEXD-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmMSFF-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmopenjpeg-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkgdcmsocketxx-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKgiftiio-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkhdf5_cpp-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkhdf5-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOBioRad-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOBMP-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOCSV-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOGDCM-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOGE-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOGIPL-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOHDF5-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOImageBase-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOIPL-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOJPEG-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOLSM-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOMesh-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOMeta-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOMRC-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIONIFTI-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIONRRD-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOPNG-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOSiemens-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOSpatialObjects-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOStimulate-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOTIFF-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOTransformBase-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOTransformHDF5-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOTransformInsightLegacy-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOTransformMatlab-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOVTK-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKIOXML-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkjpeg-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKKLMRegionGrowing-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKLabelMap-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKMesh-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKMetaIO-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itknetlib-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkNetlibSlatec-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKniftiio-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKNrrdIO-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKOptimizers-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKOptimizersv4-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKPath-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkpng-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKPolynomials-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKQuadEdgeMesh-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKSpatialObjects-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKStatistics-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itksys-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itktestlib-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itktiff-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKTransform-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkv3p_netlib-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkvcl-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKVideoCore-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKVideoIO-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkvnl_algo-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkvnl-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKVNLInstantiation-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKVTK-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKWatersheds-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/itkzlib-4.10.lib" \
"C:/InsightToolkit-4.10.0/build/lib/Release/ITKznz-4.10.lib"

SOURCES += main.cpp

我尝试了重建但没有改变。 你有想法解决这个问题吗?

谢谢!

约翰

1 个答案:

答案 0 :(得分:0)

我在使用自定义Visual Studio项目进行构建时遇到了类似的问题。缺少某些Windows标准库。对于 itkImageFileReader ,您需要 Advapi32.lib Shell32.lib

在我的visual studio项目中,继承自父项目或项目默认值未在Linker-&gt; Input-&gt; Additional Dependencies中检查。