[Insight-users] Problems when using itk with another C++ toolkit

Dalal, Dhaval dalal at bnl.gov
Thu Jun 9 15:57:07 EDT 2005


Hi 
I am trying to integrate ITK with Dcmtk(a C++ Dicom Toolkit).
I created a small C++ project(windows application). 
which includes some itk and dcmtk - header files and code.
When when i try to compile the project, i keep getting the following
warnings-
C4541: 'dynamic_cast' used on polymorphic type 'itk::EventObject' with
/GR-; unpredictable behavior may result

Which means that exceptions are not enabled. I know that ITK makes use of
C++ exceptions..

So I checked my compiler settings .By selecting "project Settings"
- Under C/C++
- Changing Category to: C++ Language
- But Here " Enable C++ Exceptions" is  already checked. I am using Visual
Studio 6.0.

Any pointers, Can i just ignore this warning?
my CMakeLists.txt file is

/////////////////////////////
PROJECT(DCMTKTEST)

FIND_PACKAGE(DCMTK)
FIND_PACKAGE(ZLIB)
# Find ITK.
FIND_PACKAGE(ITK)
IF(ITK_FOUND)
  INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
  MESSAGE(FATAL_ERROR
          "Cannot build without ITK.  Please set ITK_DIR.")
ENDIF(ITK_FOUND)


# Make sure the compiler can find include files from our library.
INCLUDE_DIRECTORIES(
 ${DCMTK_config_INCLUDE_DIR}
 ${DCMTK_dcmdata_INCLUDE_DIR}
 ${DCMTK_dcmingle_INCLUDE_DIR}
 ${DCMTK_ofstd_INCLUDE_DIR}
 ${DCMTK_DIR}/imagectn/include
 ${DCMTK_DIR}/dcmnet/include
 )

# set certain project wide flags
SET(CMAKE_C_FLAGS "" CACHE STRING "Flags for C compiler." FORCE)
SET(CMAKE_C_FLAGS_DEBUG "/nologo /MDd /W3 /GX /Z7 /Od /GR- /YX" CACHE STRING
"Win32 Debug Options C Code" FORCE)
SET(CMAKE_C_FLAGS_RELEASE "/nologo /MD /W3 /GX /O2 /GR- /YX" CACHE STRING
"Win32 Release Options C Code" FORCE)
SET(CMAKE_CXX_FLAGS "" CACHE STRING "Flags used by the compiler during all
build types." FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "/nologo /MDd /W3 /GX /Z7 /Od /GR- /YX" CACHE
STRING "Win32 Debug Options C++ Code" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE "/nologo /MD /W3 /GX /O2 /GR- /YX" CACHE STRING
"Win32 Release Options C++ Code" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO" CACHE STRING "Win32 Linker
Flags" FORCE)

FIND_LIBRARY(DCMTK_imagedb_LIBRARY libimagedb ${DCMTK_DIR}/imagectn/libsrc)
FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet ${DCMTK_DIR}/dcmnet/libsrc)


# set _REENTRANT flag
ADD_DEFINITIONS(-D_REENTRANT)
#ADD_DEFINITIONS(-DHAVE_CONFIG_H)
 

INCLUDE(${CMAKE_ROOT}/Modules/FindFLTK.cmake)
IF(HAS_FLTK)
  INCLUDE_DIRECTORIES(
    ${FLTK_INCLUDE_DIR}
    )
  LINK_LIBRARIES( 
    ${FLTK_LIBRARIES}
    )
ENDIF(HAS_FLTK)

INCLUDE_DIRECTORIES(
  ${DCMTKTEST_SOURCE_DIR} 
  ${DCMTKTEST_BINARY_DIR} 
  ) 

IF(CYGWIN)
  LINK_LIBRARIES(ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
ENDIF(CYGWIN)

SET( DCMTK_GUI_SRCS
  dcmtkui.fl
  prefsui.fl
 )

IF(FLTK_WRAP_UI)
  FLTK_WRAP_UI(ti ${DCMTK_GUI_SRCS})
 ENDIF(FLTK_WRAP_UI)



SET(DCMTKTEST_SRCS
  cnf.h
  cnf.cxx
  cnfexnt.cxx
  cnfpriv.cxx
  cnfpriv.h
  ti.cxx 
  ti.h
  tinet.cxx
  tinet.h 
  tiquery.cxx
  tiquery.h
  tiui.cxx
  tiui.h
  prefs.h
  prefs.cpp
  dcmtk.h
  dcmtk.cpp
  main.cpp
  )

ADD_EXECUTABLE( ti ${DCMTKTEST_SRCS} )


 TARGET_LINK_LIBRARIES(
  ti 
  netapi32
  wsock32
 ${DCMTK_imagedb_LIBRARY}
 ${DCMTK_dcmnet_LIBRARY}
 ${DCMTK_dcmdata_LIBRARY}
 ${DCMTK_ofstd_LIBRARY} 
 ${DCMTK_dcmimgle_LIBRARY}
# ${ZLIB_LIBRARY} 
  ITKCommon
 )
///////////////////////////////////// 

Let me know.
Thanks
Dhaval


More information about the Insight-users mailing list