[Insight-users] Link error with ITK and VTK ...

Sergio Andres sergio@unizar.es
Tue May 4 17:37:07 EDT 2004


Hi all,

Some days ago I sent a mail asking for help about some conflicts
I got when I compiled my application using ITK 1.6 and VTK 4.2 libs.

I downloaded CVS code of VTK and I got no link errors...

But I get similar link errors when I use vtkDICOMImageReader (CVS code, 
2004-04-26) and ITK 1.6..

The messages are like these:
-------------------------------------------------------------
vtkDICOMParser.lib(DICOMAppHelper.obj) : error LNK2005: "public: virtual 
void __thiscall DICOMAppHelper::PixelRepresentationCallback(class 
DICOMParser *,unsigned short,unsigned short,enum 
DICOMParser::VRTypes,unsigned char *,int)" (?PixelRepresentat
ionCallback@DICOMAppHelper@@UAEXPAVDICOMParser@@GGW4VRTypes@2@PAEH@Z) 
already defined in ITKDICOMParser.lib(DICOMAppHelper.obj)

vtkDICOMParser.lib(DICOMAppHelper.obj) : error LNK2005: "public: virtual 
void __thiscall DICOMAppHelper::PhotometricInterpretationCallback(class 
DICOMParser *,unsigned short,unsigned short,enum 
DICOMParser::VRTypes,unsigned char *,int)" (?Photometri
cInterpretationCallback@DICOMAppHelper@@UAEXPAVDICOMParser@@GGW4VRTypes@2@PAEH@Z) 
already defined in ITKDICOMParser.lib(DICOMAppHelper.obj)
-----------------------------------------------------------

My CMakeLists.txt contains the following lines:
-----------------------------------------------------------

PROJECT (Prueba_ITK_VTK)

# -----------------------------
# sources
# -----------------------------
SET(SRCS
    ${Prueba_ITK_VTK_SOURCE_DIR}/Source/main.cpp
)

#------------------------------------------------------------
# Include directories:
#------------------------------------------------------------

# ------------------------------------------
#    ITK includes and libs directories
# ------------------------------------------

FIND_PACKAGE(ITK)
IF(ITK_FOUND)
 INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
 MESSAGE(FATAL_ERROR Please set ITK_DIR.")
ENDIF(ITK_FOUND)


# -----------------------------
# VTK includes and libs directories
# -----------------------------
INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (USE_VTK_FILE)
  INCLUDE(${USE_VTK_FILE})
ENDIF (USE_VTK_FILE)

#------------------------------------------------------------
# Libraries
#------------------------------------------------------------

# ITK_LIBRARIES
SET (ITK_LIBS    
    ITKCommon
    ITKIO
)


# -----------------------------
# VTK libs
# -----------------------------
SET (VTK_LIBS
            vtkImaging
            vtkIO
            vtkCommon
)


LINK_LIBRARIES(${ITK_LIBS} ${VTK_LIBS} )

ADD_EXECUTABLE(Main ${SRCS})
-----------------------------------------------------------

So, if you know how to avoid these errors, please let me know..
Thanks!

Regards,
Sergio





More information about the Insight-users mailing list