[vtkusers] [Gdcm2] How to use vtk and gdcm in Visual Studio 2008

Jafari, Kourosh kjafari at rad.hfh.edu
Tue Jun 21 09:11:34 EDT 2011


Thanks! Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
PROJECT(TestGDCM)
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
FIND_PACKAGE(GDCM)
IF(GDCM_FOUND)
   INCLUDE(${GDCM_USE_FILE})
ENDIF(GDCM_FOUND)
INCLUDE_DIRECTORIES (
 ${VTK_INCLUDE_DIR}
 ${CMAKE_CURRENT_BINARY_DIR}
 ${CMAKE_CURRENT_SOURCE_DIR}
 )
ADD_EXECUTABLE(TestGDCM TestGDCM.cxx)
TARGET_LINK_LIBRARIES(TestGDCM
 gdcmMSFF
 vtkgdcm
 vtkCommon
 vtkRendering
 vtkIO
 vtkFiltering
 vtkGraphics
 vtkWidgets
 vtkImaging
 vtkHybrid
 vtkCharts
 vtkVolumeRendering
 )


________________________________________
From: Mark Roden [mmroden at gmail.com]
Sent: Tuesday, June 21, 2011 12:55 AM
To: Jafari, Kourosh
Cc: John Drescher; VTK; gdcm-developers
Subject: Re: [Gdcm2] How to use vtk and gdcm in Visual Studio 2008

You're mixing cmake and visual studio paradigms.  That's dangerous
territory.  If visual studio doesn't already have everything set up,
then messing with the sln file directly after building it via cmake is
going to lead to problems like this, in my experience.  I'd try to fix
your cmakelists.txt file directly.  How large is it?  Can you copy and
paste it here?

On Mon, Jun 20, 2011 at 7:10 PM, Jafari, Kourosh <kjafari at rad.hfh.edu> wrote:
> Ok, I realized that for some reason CMake does not do its job correctly. I went to Configuration Properties->Linker->General and realized that the directory of gdcm library was not there. So I added it and now I got 143 error messages. You can see part of the error messages below. Any idea what is wrong?
>
> Thanks!!
> Kourosh
>
>
> 1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Release Win32 ------
> 1>Deleting intermediate and output files for project 'ZERO_CHECK', configuration 'Release|Win32'
> 1>Checking Build System
> 1>CMake does not need to re-run because C:/Users/Kourosh/Research/Softwares/Toolkit/MyCodes/TestGDCM/CMakeFiles/generate.stamp is up-to-date.
> 1>Build log was saved at "file://c:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\ZERO_CHECK.dir\Release\BuildLog.htm"
> 1>ZERO_CHECK - 0 error(s), 0 warning(s)
> 2>------ Rebuild All started: Project: TestGDCM, Configuration: Release Win32 ------
> 2>Deleting intermediate and output files for project 'TestGDCM', configuration 'Release|Win32'
> 2>Building Custom Rule C:/Users/Kourosh/Research/Softwares/Toolkit/MyCodes/TestGDCM/CMakeLists.txt
> 2>CMake does not need to re-run because C:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\CMakeFiles\generate.stamp is up-to-date.
> 2>Compiling...
> 2>TestGDCM.cxx
> 2>Linking...
> 2>gdcmMSFF.lib(gdcmPixmapReader.obj) : error LNK2001: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ)
> 2>gdcmMSFF.lib(gdcmImageHelper.obj) : error LNK2001: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ)
> 2>vtkgdcm.lib(vtkGDCMImageReader.obj) : error LNK2019: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ) referenced in function "public: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDataElement(class gdcm::Tag const &)const " (?GetDataElement at DataSet@gdcm@@QBEABVDataElement at 2@ABVTag at 2@@Z)
> 2>gdcmMSFF.lib(gdcmImageReader.obj) : error LNK2001: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ)
> 2>gdcmMSFF.lib(gdcmOverlay.obj) : error LNK2001: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ)
> 2>gdcmMSFF.lib(gdcmCurve.obj) : error LNK2001: unresolved external symbol "protected: class gdcm::DataElement const & __thiscall gdcm::DataSet::GetDEEnd(void)const " (?GetDEEnd at DataSet@gdcm@@IBEABVDataElement at 2@XZ)
> 2>vtkgdcm.lib(vtkGDCMImageReader.obj) : error LNK2019: unresolved external symbol "public: static unsigned int __cdecl gdcm::VM::GetNumberOfElementsFromArray(char const *,unsigned int)" (?GetNumberOfElementsFromArray at VM@gdcm@@SAIPBDI at Z) referenced in function "protected: void __thiscall vtkGDCMImageReader::FillMedicalImageInformation(class gdcm::ImageReader const &)" (?FillMedicalImageInformation at vtkGDCMImageReader@@IAEXABVImageReader at gdcm@@@Z)
> 2>vtkgdcm.lib(vtkGDCMImageReader.obj) : error LNK2019: unresolved external symbol "public: unsigned int __thiscall gdcm::VR::GetSizeof(void)const " (?GetSizeof at VR@gdcm@@QBEIXZ) referenced in function "protected: void __thiscall vtkGDCMImageReader::FillMedicalImageInformation(class gdcm::ImageReader const &)" (?FillMedicalImageInformation at vtkGDCMImageReader@@IAEXABVImageReader at gdcm@@@Z)
> 2>gdcmMSFF.lib(gdcmImageHelper.obj) : error LNK2001: unresolved external symbol "public: unsigned int __thiscall gdcm::VR::GetSizeof(void)const " (?GetSizeof at VR@gdcm@@QBEIXZ)
> 2>vtkgdcm.lib(vtkGDCMImageReader.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall gdcm::MediaStorage::SetFromFile(class gdcm::File const &)" (?SetFromFile at MediaStorage@gdcm@@QAE_NABVFile at 2@@Z) referenced in function "protected: int __thiscall vtkGDCMImageReader::RequestInformationCompat(void)" (?RequestInformationCompat at vtkGDCMImageReader@@IAEHXZ)
> 2>gdcmMSFF.lib(gdcmPixmapReader.obj) : error LNK2001: unresolved external symbol "public: bool __thiscall gdcm::MediaStorage::SetFromFile(class gdcm::File const &)" (?SetFromFile at MediaStorage@gdcm@@QAE_NABVFile at 2@@Z)
> 2>gdcmMSFF.lib(gdcmImageHelper.obj) : error LNK2001: unresolved external symbol "public: bool __thiscall gdcm::MediaStorage::SetFromFile(class gdcm::File const &)" (?SetFromFile at MediaStorage@gdcm@@QAE_NABVFile at 2@@Z)
> 2>gdcmMSFF.lib(gdcmBitmap.obj) : error LNK2019: unresolved external symbol "public: static char const * __cdecl gdcm::TransferSyntax::GetTSString(enum gdcm::TransferSyntax::TSType)" (?GetTSString at TransferSyntax@gdcm@@SAPBDW4TSType at 12@@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl gdcm::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class gdcm::TransferSyntax const &)" (??6gdcm@@YAAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@AAV12 at ABVTransferSyntax@0@@Z)
> 2>gdcmMSFF.lib(gdcmRLECodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::Fragment const & __thiscall gdcm::SequenceOfFragments::GetFragment(unsigned int)const " (?GetFragment at SequenceOfFragments@gdcm@@QBEABVFragment at 2@I at Z)
> 2>gdcmMSFF.lib(gdcmBitmap.obj) : error LNK2019: unresolved external symbol "public: class gdcm::Fragment const & __thiscall gdcm::SequenceOfFragments::GetFragment(unsigned int)const " (?GetFragment at SequenceOfFragments@gdcm@@QBEABVFragment at 2@I at Z) referenced in function "protected: bool __thiscall gdcm::Bitmap::TryJPEGCodec(char *,bool &)const " (?TryJPEGCodec at Bitmap@gdcm@@IBE_NPADAA_N at Z)
> 2>gdcmMSFF.lib(gdcmJPEGCodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::Fragment const & __thiscall gdcm::SequenceOfFragments::GetFragment(unsigned int)const " (?GetFragment at SequenceOfFragments@gdcm@@QBEABVFragment at 2@I at Z)
> 2>gdcmMSFF.lib(gdcmJPEGLSCodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::Fragment const & __thiscall gdcm::SequenceOfFragments::GetFragment(unsigned int)const " (?GetFragment at SequenceOfFragments@gdcm@@QBEABVFragment at 2@I at Z)
> 2>gdcmMSFF.lib(gdcmJPEG2000Codec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::Fragment const & __thiscall gdcm::SequenceOfFragments::GetFragment(unsigned int)const " (?GetFragment at SequenceOfFragments@gdcm@@QBEABVFragment at 2@I at Z)
> 2>gdcmMSFF.lib(gdcmRLECodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ)
> 2>gdcmMSFF.lib(gdcmPixmapReader.obj) : error LNK2001: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ)
> 2>gdcmMSFF.lib(gdcmBitmap.obj) : error LNK2019: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ) referenced in function "protected: bool __thiscall gdcm::Bitmap::TryJPEGCodec(char *,bool &)const " (?TryJPEGCodec at Bitmap@gdcm@@IBE_NPADAA_N at Z)
> 2>gdcmMSFF.lib(gdcmJPEGCodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ)
> 2>gdcmMSFF.lib(gdcmJPEGLSCodec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ)
> 2>gdcmMSFF.lib(gdcmJPEG2000Codec.obj) : error LNK2001: unresolved external symbol "public: class gdcm::SequenceOfFragments const * __thiscall gdcm::DataElement::GetSequenceOfFragments(void)const " (?GetSequenceOfFragments at DataElement@gdcm@@QBEPBVSequenceOfFragments at 2@XZ)
> 2>gdcmMSFF.lib(gdcmBitmap.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall gdcm::TransferSyntax::IsLossy(void)const " (?IsLossy at TransferSyntax@gdcm@@QBE_NXZ) referenced in function "protected: bool __thiscall gdcm::Bitmap::TryKAKADUCodec(char *,bool &)const " (?TryKAKADUCodec at Bitmap@gdcm@@IBE_NPADAA_N at Z)
> 2>gdcmMSFF.lib(gdcmJPEG2000Codec.obj) : error LNK2001: unresolved external symbol "public: bool __thiscall gdcm::TransferSyntax::IsLossy(void)const " (?IsLossy at TransferSyntax@gdcm@@QBE_NXZ)
> 2>gdcmMSFF.lib(gdcmImageChangePlanarConfiguration.obj) : error LNK2019: unresolved external symbol "public: bool __thiscall gdcm::TransferSyntax::IsImplicit(void)const " (?IsImplicit at TransferSyntax@gdcm@@QBE_NXZ) referenced in function "public: bool __thiscall gdcm::ImageChangePlanarConfiguration::Change(void)" (?Change at ImageChangePlanarConfiguration@gdcm@@QAE_NXZ)
> 2>gdcmMSFF.lib(gdcmRAWCodec.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl gdcm::Unpacker12Bits::Unpack(char *,char const *,unsigned int)" (?Unpack at Unpacker12Bits@gdcm@@SA_NPADPBDI at Z) referenced in function "public: bool __thiscall gdcm::RAWCodec::DecodeBytes(char const *,unsigned int,char *,unsigned int)" (?DecodeBytes at RAWCodec@gdcm@@QAE_NPBDIPADI at Z)
> 2>gdcmMSFF.lib(gdcmImageCodec.obj) : error LNK2019: unresolved external symbol "public: static char const * __cdecl gdcm::SwapCode::GetSwapCodeString(class gdcm::SwapCode const &)" (?GetSwapCodeString at SwapCode@gdcm@@SAPBDABV12@@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl gdcm::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class gdcm::SwapCode const &)" (??6gdcm@@YAAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@AAV12 at ABVSwapCode@0@@Z)
>
> ...
> ...
> ...
> ...
> ...
>
>
> 2>gdcmMSFF.lib(gdcmJPEG8Codec.obj) : error LNK2019: unresolved external symbol _gdcmjpeg8_jpeg_finish_decompress referenced in function "public: virtual bool __thiscall gdcm::JPEG8Codec::Decode(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?Decode at JPEG8Codec@gdcm@@UAE_NAAV?$basic_istream at DU?$char_traits at D@std@@@std@@AAV?$basic_ostream at DU?$char_traits at D@std@@@4@@Z)
> 2>gdcmMSFF.lib(gdcmJPEG8Codec.obj) : error LNK2019: unresolved external symbol _gdcmjpeg8_jpeg_read_scanlines referenced in function "public: virtual bool __thiscall gdcm::JPEG8Codec::Decode(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?Decode at JPEG8Codec@gdcm@@UAE_NAAV?$basic_istream at DU?$char_traits at D@std@@@std@@AAV?$basic_ostream at DU?$char_traits at D@std@@@4@@Z)
> 2>gdcmMSFF.lib(gdcmJPEG8Codec.obj) : error LNK2019: unresolved external symbol _gdcmjpeg8_jpeg_start_decompress referenced in function "public: virtual bool __thiscall gdcm::JPEG8Codec::Decode(class std::basic_istream<char,struct std::char_traits<char> > &,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?Decode at JPEG8Codec@gdcm@@UAE_NAAV?$basic_istream at DU?$char_traits at D@std@@@std@@AAV?$basic_ostream at DU?$char_traits at D@std@@@4@@Z)
> 2>C:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\Release\TestGDCM.exe : fatal error LNK1120: 111 unresolved externals
> 2>Build log was saved at "file://c:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\TestGDCM.dir\Release\BuildLog.htm"
> 2>TestGDCM - 143 error(s), 0 warning(s)
> ========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
>
>
>
>
>
>
>
>
> ________________________________________
> From: John Drescher [drescherjm at gmail.com]
> Sent: Sunday, June 19, 2011 9:27 PM
> To: Jafari, Kourosh
> Cc: VTK; gdcm-developers
> Subject: Re: [Gdcm2] How to use vtk and gdcm in Visual Studio 2008
>
> On Sun, Jun 19, 2011 at 8:53 PM, Jafari, Kourosh <kjafari at rad.hfh.edu> wrote:
>> John,
>>
>> I think I did not understand your question. Did you mean adding "gdcmMSFF" to TARGET_LINK_LIBRARIES in CMakeLists.txt of my project (TestGDCM)? If so, yes I did.
>>
>
> Yes, I believe there are at least 2 gdcm libraries you need to add to
> your  TARGET_LINK_LIBRARIES for this to work. Although with that said
> I have not tried gdcm 2.0.17 yet. I am using an earlier version with
> both of my current applications (CMake + VS 2008 or 2010 + Qt + GDCM +
> ITK).
>
> John


More information about the vtkusers mailing list