[CMake] duplicate symbol error in Mac os X 10.5

Manuel Ricardo Galindo mrgalindo at gmail.com
Sun Jul 27 14:16:21 EDT 2008


Hello All

I am trying to start testing an application i developed on Mac Os X 10.5.
The application uses ITK,VTK and Qt.

The problem is that using the same CMakeLists.cmake it compiles and links
perfectly in VC7 but it gives me the following error when i try to build it
using XCode

ld: duplicate symbol itk::Image<unsigned short, 3u>::GetNameOfClass()
constin
/Developer/usr/GUI_ICPbin/GUI_ICP.build/Release/GUI_ICPHeaders.build/Objects-normal/i386/itkMeshTovtkUnstructuredGrid.o
and
/Developer/usr/GUI_ICPbin/GUI_ICP.build/Release/GUI_ICPHeaders.build/Objects-normal/i386/mainWin.o

I am not so experienced in the linking part of the process so i would really
apprecitae some help about this issue.

The CMakeLists.cmake i successfully use to build in VC7 is:

PROJECT(GUI_ICP)

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

FIND_PACKAGE(VTK)
IF(NOT VTK_DIR)
  MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
ENDIF(NOT VTK_DIR)
INCLUDE(${VTK_USE_FILE})

# use what QVTK built with
SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
SET(DESIRED_QT_VERSION ${VTK_DESIRED_QT_VERSION} CACHE FILEPATH "")
FIND_PACKAGE(Qt)
IF(QT_USE_FILE)
  INCLUDE(${QT_USE_FILE})
ELSE(QT_USE_FILE)
  SET(QT_LIBRARIES   ${QT_QT_LIBRARY})
ENDIF(QT_USE_FILE)

SET (GUI_ICP
  main.cxx
  mainWin.cxx
  matrixWidget.cxx
  ParametersWidget.cxx
  algorithmsWidget.cxx
  RegistrationAlgorithms.cxx
  Utilities.cxx
  ExtremalPoints.cxx
  ResultsWidget.cxx
  itkImageToVTKImageFilter.cxx
  SurfRec.cxx
  vtkPowerCrustSurfaceReconstruction.cxx
  SliceManager.cxx
  itkMeshTovtkUnstructuredGrid.cxx
  Bimg2itkmesh.cxx
)

# Use the include path and library for Qt that is used by VTK.
INCLUDE_DIRECTORIES(
  ${QT_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)


  SET (GUI_ICPHeaders mainWin.h matrixWidget.h ParametersWidget.h
algorithmsWidget.h ResultsWidget.h SliceManager.h)
  QT4_WRAP_CPP(MOCSrcs ${GUI_ICPHeaders} )
  ADD_DEFINITIONS(-DQT_GUI_LIBS -DQT_CORE_LIB -DQT3_SUPPORT)
  SET_SOURCE_FILES_PROPERTIES(${GUI_ICP} PROPERTIES)


ADD_EXECUTABLE( GUI_ICP MACOSX_BUNDLE ${GUI_ICP} ${MOCSrcs})

TARGET_LINK_LIBRARIES( GUI_ICP
  QVTK
  ${QT_LIBRARIES}
  vtkRendering
  vtkGraphics
  vtkIO
  vtkCommon
  vtkHybrid
  vtkWidgets
  ITKAlgorithms
  ITKStatistics
  ITKIO
  ITKBasicFilters
  ITKCommon
)

I am using Cmake 2.4.8 on my mac

Thank you in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080727/ae694694/attachment.htm>


More information about the CMake mailing list