[Insight-users] linking error with itkDICOMSeriesFileNames

Luis Ibanez luis . ibanez at kitware . com
Thu, 25 Sep 2003 11:40:41 -0400


Hi Soumen,


1) Please don't use absolute paths for the source
    files in the ADD_EXECUTABLE command. CMakeLists.txt
    files are structured as Makefiles. You should have
    one on each subdirectory of your project, and each
    one building .cxx files in the directory where the
    CMakeLists.txt file is located.


2) The .txx files don't have to be added to the
    list of sources in the ADD_EXECUTABLE command.
    As far as the compiler is concernened, a .txx
    is like a .h file.


3) The DICOM series file name object file is in
    the ITKIO library. Please add this one to the
    TARGET_LINK_LIBRARIES command.



Regards,


    Luis


----
soumen dey wrote:
> Hi All,
>  
> I have encountered some linking problem while working with 
> itkDICOMSeriesFileNames.
>  
> the include files are....
>  
> #include "itkDICOMImageIO2Factory.h"
> #include "itkDICOMImageIO2.h"
> #include "itkImageSeriesReader.h"
> #include "itkDICOMSeriesFilenames.h"
> #include "vtkImageViewer.h"
> #include "vtkRenderWindowInteractor.h"
> #include "itkImageToVTKImageFilter.h"
> my cmakelist looks like...
>  
> PROJECT(itkvtk)
> FIND_PACKAGE(ITK)
> IF (ITK_FOUND)
>     INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
> FIND_PACKAGE(VTK)
> IF(VTK_FOUND)
>     INCLUDE(${VTK_USE_FILE})
> ENDIF(VTK_FOUND)
> ADD_EXECUTABLE(ImageReadCastWrite ImageReadCastWrite2.cxx
> c:\\soumen\\itk\\itksource\\Code\\io\\itkDICOMImageSeriesTest.cxx
> c:\\soumen\\itk\\itksource\\code\\BasicFilters\\itkImageToVTKImageFilter.txx
> c:\\soumen\\itk\\itksource\\Code\\BasicFilters\\itkVTKImageExport.txx
> c:\\soumen\\itk\\itksource\\Code\\BasicFilters\\itkVTKImageExportBase.cxx
> )
> TARGET_LINK_LIBRARIES(ImageReadCastWrite ${ITK_LIBRARIES} ${VTK_LIBRARIES}
> VTKZlib
> VTKGraphics
> VTKRendering
> VTKImaging
> VTKFiltering
> VTKCommon
> VTKIO
> ITKDicomParser
> )
>  
> and the linking error are....
>  
> Linking...
>    Creating library Debug/ImageReadCastWrite.lib and object 
> Debug/ImageReadCastWrite.exp
> ImageReadCastWrite2.obj : error LNK2001: unresolved external symbol 
> "public: class std::vector<class std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >,class 
> std::allocator<class std::basic_string<char,struct std::char
> _traits<char>,class std::allocator<char> > > > const & __thiscall 
> itk::DICOMSeriesFileNames::GetFileNames(void)" 
> (?GetFileNames at DICOMSeriesFileNames@itk@@QAEABV?$vector at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@V?$allocator at V?$ba
> sic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@2@@std@@XZ)
> itkDICOMImageSeriesTest.obj : error LNK2001: unresolved external symbol 
> "public: class std::vector<class std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >,class 
> std::allocator<class std::basic_string<char,struct std::
> char_traits<char>,class std::allocator<char> > > > const & __thiscall 
> itk::DICOMSeriesFileNames::GetFileNames(void)" 
> (?GetFileNames at DICOMSeriesFileNames@itk@@QAEABV?$vector at V?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@V?$allocator at V
> ?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@@2@@std@@XZ)
> ImageReadCastWrite2.obj : error LNK2001: unresolved external symbol 
> "protected: __thiscall 
> itk::DICOMSeriesFileNames::DICOMSeriesFileNames(void)" 
> (??0DICOMSeriesFileNames at itk@@IAE at XZ)
> itkDICOMImageSeriesTest.obj : error LNK2001: unresolved external symbol 
> "protected: __thiscall 
> itk::DICOMSeriesFileNames::DICOMSeriesFileNames(void)" 
> (??0DICOMSeriesFileNames at itk@@IAE at XZ)
> Debug/ImageReadCastWrite.exe : fatal error LNK1120: 2 unresolved externals
> Error executing link.exe.
> ImageReadCastWrite.exe - 5 error(s), 0 warning(s)
>  
>  
> will anybody plz help me out.
>  
> Rahul
>