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

Jafari, Kourosh kjafari at rad.hfh.edu
Sat Jun 18 15:42:04 EDT 2011


Dear vtk users,

I am trying to use vtk and gdcm together in Visual Studio 2008. I already had vtk 5.6.0. I downloaded and built gdcm 2.0.17 using CMake and Visual Studio 2008. It built gdcm with 20 errors. For example:


13>gdcmJPEG2000Codec.obj : error LNK2019: unresolved external symbol __imp__gdcmopenjpeg_opj_stream_set_seek_function at 8 referenced in function "void * * __stdcall gdcm::opj_stream_create_memory_stream(struct gdcm::myfile *,unsigned int,bool)" (?opj_stream_create_memory_stream at gdcm@@


Now I have generated a simple project using the following 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}
  )
LINK_LIBRARIES (
  vtkCommon
  vtkRendering
  vtkIO
  vtkFiltering
  vtkGraphics
  vtkWidgets
  vtkImaging
  vtkHybrid
  vtkCharts
  vtkVolumeRendering
  )
ADD_EXECUTABLE(TestGDCM TestGDCM.cxx)
TARGET_LINK_LIBRARIES(TestGDCM)

I get the following compilation errors:


1>------ Build started: Project: TestGDCM, Configuration: Release Win32 ------

1>Linking...

1>TestGDCM.obj : error LNK2019: unresolved external symbol "public: static class vtkGDCMImageReader * __cdecl vtkGDCMImageReader::New(void)" (?New at vtkGDCMImageReader@@SAPAV1 at XZ) referenced in function _main

1>C:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\Release\TestGDCM.exe : fatal error LNK1120: 1 unresolved externals

1>Build log was saved at "file://c:\Users\Kourosh\Research\Softwares\Toolkit\MyCodes\TestGDCM\TestGDCM.dir\Release\BuildLog.htm"

1>TestGDCM - 2 error(s), 0 warning(s)

2>------ Skipped Build: Project: ALL_BUILD, Configuration: Release Win32 ------

2>Project not selected to build for this solution configuration

========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========


Any idea what is wrong?

Thanks!
Kourosh




More information about the vtkusers mailing list