[Insight-users] Link error : DICOMParser duplicate symbols in ITK + VTK

Luis Ibanez luis.ibanez at kitware.com
Thu, 18 Mar 2004 07:18:47 -0500


Hi Corinne,

This issue is an open Bug in ITK:  Bug# 684.

  http://www.itk.org/Bug/bug.php?op=show&bugid=684&pos=25

What happens is that the same DICOMParser code has been
contributed to both toolkits ITK and VTK, but no precautions
were taken for avoiding namespace collisions when projects
use both toolkits simultaneously.

The solution is known but it has not been implemented yet.

You may want to log in the Bug tracker and vote for
this bug in order to increase its priority.

In the meantime,
I'm afraid that the solution is to stick to VTK 4.2,
...unless you feel adventurous and are willing to tweak
VTK's CMakeLists.txt files in order to disable the compilation
of the DICOMParser and DICOM readers.



Regards,


    Luis


------------------------------
Corinne Mattmann wrote:

> Hi,
> 
> I use ITK and VTK. Lately, I decided to replace VTK version 4.2 with the
> latest CVS version. When I recompiled all my projects, I got the link
> errors attached at the end of this email. All the projects which do not
> link anymore seem to have in common that they use VTK and include the
> itkImageFileReader.h (see an example of the included *.h-files further
> down). I use the latest CVS version of ITK (today).
> Does somebody know what is wrong here?
> 
> Thanks very much,
> Corinne
> 
> ---------------------------------------
>  
> #include <iostream>
> #include <sstream>
> 
> #include "itkWarpImageFilter.h"
> #include "itkImageFileReader.h"
> #include "itkImageToVTKImageFilter.h"
> #include "itkVectorIndexSelectionCastImageFilter.h"
> #include "itkRescaleIntensityImageFilter.h"
> #include "itkHistogramMatchingImageFilter.h"
> #include "itkFEM.h"
> #include "itkFEMRegistrationFilter.h"
> 
> #include "vtkMarchingCubes.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkPointData.h"
> #include "vtkFloatArray.h"
> #include "vtkCellArray.h"
> #include "vtkPolyData.h"
> #include "vtkMaskPolyData.h"
> #include "vtkProperty.h"
> 
> ----------------------------------------
> 
> Linking...
> ITKDICOMParser.lib(DICOMParser.obj) : error LNK2005: "public: __thiscall
> DICOMParser::DICOMParser(void)" (??0DICOMParser at  at QAE at XZ) already defined
> in vtkDICOMParser.lib(vtkDICOMParser.dll)
> ITKDICOMParser.lib(DICOMParser.obj) : error LNK2005: "public: bool
> __thiscall DICOMParser::OpenFile(class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > const &)"
> (?OpenFile at DICOMParser at  at QAE_NABV?$basic_string at DU?$
> char_traits at D at std at  at V?$allocator at D at 2 at  at std at  at  at Z) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll)
> ITKDICOMParser.lib(DICOMParser.obj) : error LNK2005: "public: bool
> __thiscall DICOMParser::ReadHeader(void)"
> (?ReadHeader at DICOMParser at  at QAE_NXZ) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll)
> ITKDICOMParser.lib(DICOMParser.obj) : error LNK2005: "public: void
> __thiscall DICOMParser::ClearAllDICOMTagCallbacks(void)"
> (?ClearAllDICOMTagCallbacks at DICOMParser at  at QAEXXZ) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll)
> ITKDICOMParser.lib(DICOMParser.obj) : warning LNK4006: "public:
> __thiscall DICOMParser::DICOMParser(void)" (??0DICOMParser at  at QAE at XZ)
> already defined in vtkDICOMParser.lib(vtkDICOMParser.dll); second
> definition ignored
> ITKDICOMParser.lib(DICOMParser.obj) : warning LNK4006: "public: bool
> __thiscall DICOMParser::OpenFile(class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > const &)"
> (?OpenFile at DICOMParser at  at QAE_NABV?$basic_string at DU
> ?$char_traits at D at std at  at V?$allocator at D at 2 at  at std at  at  at Z) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll); second definition ignored
> ITKDICOMParser.lib(DICOMParser.obj) : warning LNK4006: "public: bool
> __thiscall DICOMParser::ReadHeader(void)"
> (?ReadHeader at DICOMParser at  at QAE_NXZ) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll); second definition ignored
> ITKDICOMParser.lib(DICOMParser.obj) : warning LNK4006: "public: void
> __thiscall DICOMParser::ClearAllDICOMTagCallbacks(void)"
> (?ClearAllDICOMTagCallbacks at DICOMParser at  at QAEXXZ) already defined in
> vtkDICOMParser.lib(vtkDICOMParser.dll); second definiti
> on ignored
>    Creating library D:\packwin\vtkMy\bin\bin\Debug/test6_Corinne.lib and
> object D:\packwin\vtkMy\bin\bin\Debug/test6_Corinne.exp
> D:\packwin\vtkMy\bin\bin\Debug/test6_Corinne.exe : fatal error LNK1169:
> one or more multiply defined symbols found
> Error executing link.exe.
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>