[vtkusers] LNK2019 error when compiling project with ITK and VTK

Luis Ibanez luis.ibanez at kitware.com
Sun Apr 10 19:15:37 EDT 2011


Hi Michal,


You are missing to link to the library

                        ITKBasicFilters


In general, whenever you get a link error about missing
symbols, you could try greping for that symbol in the
source tree of the toolkit (that's the beauty of open source).

In this case, if you grep for the symbol with the command:

               grep -lr GetCallbackUserData *

you will get:

Code/BasicFilters/itkVTKImageExportBase.h
Code/BasicFilters/itkVTKImageExportBase.cxx
Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/src/itkVTKImageToImageFilter.txx
Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/src/itkImageToVTKImageFilter.txx


you can discard the hits in the Wrapping directory
(unless you are doing wrapping, of course).


So you are left with a .cxx file in the directory

             Code/BasicFilters

If you then open the CMakeLists.txt file and search
for "itkVTKImageExportBase.cxx" you will find it in
the line:

ADD_LIBRARY(ITKBasicFilters itkVTKImageExportBase.cxx)

Which states the the itkVTKImageExportBase.cxx will be
used to create the library "ITKBasicFilters".


Therefore,...
you can resolve the missing symbol by adding

                    ITKBasicFilters

to your list of libraries to link against.


---------------------------------------------------------------------


   "Glimpsing at the Source
     leavers no doubt"

                           Ming Dao


----------------------------------------------------------------------


     Luis


------------------------------------------------
On Sun, Apr 10, 2011 at 1:08 PM, Bc. Michal Srna <michal at srna.info> wrote:
> Hello VTK users,
>
> in my project I use ITKv4 and now I would like to use some features of VTK.
> I downloaded the latest version vtk-5.6.1, used CMAKE, without errors build
> VTK with MVSC++ 2008 and added path to all VTK libraries to project
> properties. I also added all VTK *.lib files to Additional Dependencies
> under project properties.
>
> Now I want only to connect output of ITK pipeline to VTK, the code is:
>
> typedef itk::ImageToVTKImageFilter<TransformedImageType> ConnectorType;
> ConnectorType::Pointer connector= ConnectorType::New();
>
> connector->SetInput( TransformedImportFilter->GetOutput() );
>
> where TransformedImportFilter is ITK output of ImportImageFilter.
>
> I also included this headers:
>
> #include "itkImageToVTKImageFilter.h"
>
> When I want to compile my project, I get these errors:
>
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: void * __thiscall
> itk::VTKImageExportBase::GetCallbackUserData(void)"
> (?GetCallbackUserData at VTKImageExportBase@itk@@QAEPAXXZ) referenced in
> function "protected: __thiscall itk::ImageToVTKImageFilter<class
> itk::Image<short,3> >::ImageToVTKImageFilter<class itk::Image<short,3>
>>(void)" (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: void * (__cdecl*__thiscall
> itk::VTKImageExportBase::GetBufferPointerCallback(void)const )(void *)"
> (?GetBufferPointerCallback at VTKImageExportBase@itk@@QBEP6APAXPAX at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: int * (__cdecl*__thiscall
> itk::VTKImageExportBase::GetDataExtentCallback(void)const )(void *)"
> (?GetDataExtentCallback at VTKImageExportBase@itk@@QBEP6APAHPAX at ZXZ) referenced
> in function "protected: __thiscall itk::ImageToVTKImageFilter<class
> itk::Image<short,3> >::ImageToVTKImageFilter<class itk::Image<short,3>
>>(void)" (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: void (__cdecl*__thiscall
> itk::VTKImageExportBase::GetUpdateDataCallback(void)const )(void *)"
> (?GetUpdateDataCallback at VTKImageExportBase@itk@@QBEP6AXPAX at ZXZ) referenced
> in function "protected: __thiscall itk::ImageToVTKImageFilter<class
> itk::Image<short,3> >::ImageToVTKImageFilter<class itk::Image<short,3>
>>(void)" (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: void (__cdecl*__thiscall
> itk::VTKImageExportBase::GetPropagateUpdateExtentCallback(void)const )(void
> *,int *)"
> (?GetPropagateUpdateExtentCallback at VTKImageExportBase@itk@@QBEP6AXPAXPAH at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: int (__cdecl*__thiscall
> itk::VTKImageExportBase::GetNumberOfComponentsCallback(void)const )(void *)"
> (?GetNumberOfComponentsCallback at VTKImageExportBase@itk@@QBEP6AHPAX at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: char const * (__cdecl*__thiscall
> itk::VTKImageExportBase::GetScalarTypeCallback(void)const )(void *)"
> (?GetScalarTypeCallback at VTKImageExportBase@itk@@QBEP6APBDPAX at ZXZ) referenced
> in function "protected: __thiscall itk::ImageToVTKImageFilter<class
> itk::Image<short,3> >::ImageToVTKImageFilter<class itk::Image<short,3>
>>(void)" (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: class itk::VTKImageExportBase::CallbackTypeProxy __thiscall
> itk::VTKImageExportBase::GetOriginCallback(void)const "
> (?GetOriginCallback at VTKImageExportBase@itk@@QBE?AVCallbackTypeProxy at 12@XZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: class itk::VTKImageExportBase::CallbackTypeProxy __thiscall
> itk::VTKImageExportBase::GetSpacingCallback(void)const "
> (?GetSpacingCallback at VTKImageExportBase@itk@@QBE?AVCallbackTypeProxy at 12@XZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: int * (__cdecl*__thiscall
> itk::VTKImageExportBase::GetWholeExtentCallback(void)const )(void *)"
> (?GetWholeExtentCallback at VTKImageExportBase@itk@@QBEP6APAHPAX at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: int (__cdecl*__thiscall
> itk::VTKImageExportBase::GetPipelineModifiedCallback(void)const )(void *)"
> (?GetPipelineModifiedCallback at VTKImageExportBase@itk@@QBEP6AHPAX at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "public: void (__cdecl*__thiscall
> itk::VTKImageExportBase::GetUpdateInformationCallback(void)const )(void *)"
> (?GetUpdateInformationCallback at VTKImageExportBase@itk@@QBEP6AXPAX at ZXZ)
> referenced in function "protected: __thiscall
> itk::ImageToVTKImageFilter<class itk::Image<short,3>
>>::ImageToVTKImageFilter<class itk::Image<short,3> >(void)"
> (??0?$ImageToVTKImageFilter at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2019: unresolved external symbol
> "protected: __thiscall itk::VTKImageExportBase::VTKImageExportBase(void)"
> (??0VTKImageExportBase at itk@@IAE at XZ) referenced in function "protected:
> __thiscall itk::VTKImageExport<class itk::Image<short,3>
>>::VTKImageExport<class itk::Image<short,3> >(void)"
> (??0?$VTKImageExport at V?$Image at F$02 at itk@@@itk@@IAE at XZ)
> 1>visualization_routines.obj : error LNK2001: unresolved external symbol
> "protected: virtual void __thiscall
> itk::VTKImageExportBase::UpdateInformationCallback(void)"
> (?UpdateInformationCallback at VTKImageExportBase@itk@@MAEXXZ)
> 1>visualization_routines.obj : error LNK2001: unresolved external symbol
> "protected: virtual int __thiscall
> itk::VTKImageExportBase::PipelineModifiedCallback(void)"
> (?PipelineModifiedCallback at VTKImageExportBase@itk@@MAEHXZ)
> 1>visualization_routines.obj : error LNK2001: unresolved external symbol
> "protected: virtual void __thiscall
> itk::VTKImageExportBase::UpdateDataCallback(void)"
> (?UpdateDataCallback at VTKImageExportBase@itk@@MAEXXZ)
> 1>visualization_routines.obj : error LNK2001: unresolved external symbol
> "protected: virtual void __thiscall itk::VTKImageExportBase::PrintSelf(class
> std::basic_ostream<char,struct std::char_traits<char> > &,class
> itk::Indent)const "
> (?PrintSelf at VTKImageExportBase@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@VIndent at 2@@Z)
>
> Don't know, what am I doing wrong?
>
>
>
> Best regards,
>
> Michal
>
> Faculty of Biomedical Engineering CTU
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list