Dave
Dave

Reputation: 85

Linker error when using ITK in QT

I am trying to use ITK within QT (New to QT and rusty in ITK) I was finally able to define the include paths and .lib but I am still not able to run my code. It is a simple dicom reader:

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();

The error comes at the last line and I get the following error

ITKIOGDCM-4.2.lib(itkGDCMImageIO.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall gdcm::Rescaler::SetPixelFormat(class gdcm::PixelFormat const &)" (__imp_?SetPixelFormat@Rescaler@gdcm@@QAEXABVPixelFormat@2@@Z) referenced in function "public: virtual void __thiscall itk::GDCMImageIO::Read(void *)" (?Read@GDCMImageIO@itk@@UAEXPAX@Z)

100 odd times over.

Does anyone know how to solve this linker error or know were I might get a hint to the answer?

Upvotes: 0

Views: 471

Answers (2)

Matt McCormick
Matt McCormick

Reputation: 314

Please try using CMake to generate the build files. It takes much less time, and all your issues will go away.

Upvotes: 1

colddie
colddie

Reputation: 1049

This link error probably is from the inconsistent compiled version between ITK and your Qt compiler. Make sure your ITK is built with the MSVC2010, for example, while your Qt SDK default compiler is the same.

Upvotes: 1

Related Questions