我正在嘗試在QT中使用ITK(新增QT和ITK生鏽)我終於可以定義包含路徑和.lib,但我仍然無法運行我的代碼。這是一個簡單的DICOM讀者:在QT中使用ITK時出現鏈接器錯誤
typedef signed short InputPixelType;
const unsigned int InputDimension = 2;
typedef itk::Image< InputPixelType, InputDimension > InputImageType;
typedef itk::ImageFileReader<InputImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("C:\Users\dmilford\Desktop\PvMRIm1");
typedef itk::GDCMImageIO ImageIOType;
ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
的錯誤出現在最後一行,我在收到以下錯誤
ITKIOGDCM-4.2.lib(itkGDCMImageIO.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall gdcm::Rescaler::SetPixelFormat(class gdcm::PixelFormat const &)" ([email protected]@[email protected]@[email protected]@@Z) referenced in function "public: virtual void __thiscall itk::GDCMImageIO::Read(void *)" ([email protected]@[email protected]@[email protected])
100倍多。
有誰知道如何解決這個鏈接器錯誤或知道我可能得到一個提示的答案?
嗨,謝謝你的回覆。 ITK使用MSVC2010構建,QT使用相同的編譯器運行。事實上,我直接與MSVC2010做了相同的程序,包含路徑和Lib,我得到了幾乎相同的錯誤:ITKIOGDCM-4.2.lib(itkGDCMImageIO.obj):警告LNK4217。任何其他想法? – Dave
錯誤是關於gdcm還是其他人? – colddie
如果是前者,請取消選中ITK_USE_SYSTEM_GDCM;或者稍後,您可能不需要構建ITK靜態庫。 – colddie