[Insight-users] Atttempting to build DicomImageViewer

Luis Ibanez luis.ibanez at kitware.com
Wed Jun 18 14:50:13 EDT 2008


Hi wwhartenby


You are very close.


It seems that now you are simply missing to link with the ITK libraries.


You may want to add the following line to your CMakeLists.txst file:

    TARGET_LINK_LIBRARIES( DicomImageViewer ITKIO ITKCommon )


It should go just after your current line

    ADD_EXECUTABLE( DicomImageViewer DicomImageViewer.cxx )


so, at the end it will look like:

    ADD_EXECUTABLE( DicomImageViewer DicomImageViewer.cxx )
    TARGET_LINK_LIBRARIES( DicomImageViewer ITKIO ITKCommon )


   Regards,


       Luis


-------------------------------------
wwhartenby at physics.ucsd.edu wrote:
> I am trying to build DicomImageViewer in Visual studio using CMake2.6.
> Below is the CMake file I use, and abelow that is a list of errors I get.
> I am sure that I built ITK and FLTK correctly (in that order) Anyone know
> why this is? Please also reply to my e-mail if you do. Thanks!
> 
> *****************CMAKEFILE
> 
> cmake_minimum_required(VERSION 2.4)
> if(COMMAND cmake_policy)
>   cmake_policy(SET CMP0003 NEW)
> endif (COMMAND cmake_policy)
> PROJECT(DicomImageViewer)
> SET(InsightApplications_SOURCE_DIR
> "N:/Will/CERR/ITK/InsightApplications-3.6.0")
> SET(InsightApplications_BINARY_DIR "N:/Will/CERR/ITK/InsightBinary-3.6.0")
> 
>   FIND_PACKAGE(ITK)
>   IF(ITK_FOUND)
>     INCLUDE(${ITK_USE_FILE})
>   ELSE(ITK_FOUND)
>     MESSAGE(FATAL_ERROR
>             "Cannot build InsightApplications without ITK.  Please set
> ITK_DIR.")
>   ENDIF(ITK_FOUND)
> 
>   FIND_PACKAGE(FLTK)
>   IF(FLTK_FOUND)
>     INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
>   ENDIF(FLTK_FOUND)
> 
> INCLUDE_DIRECTORIES(
> ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer)
> 
> LINK_LIBRARIES (
>   ITKBasicFilters
>   ITKIO
>   ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer/debug/ITKFltkImageViewer.lib
>   ${FLTK_LIBRARIES}
> )
> 
> 
> ADD_EXECUTABLE( DicomImageViewer DicomImageViewer.cxx )
> 
> 
> 
> 
> *************ERRORS*************************************
> 
> Error	1	error LNK2005: "public: __thiscall itk::Indent::Indent(int)"
> (??0Indent at itk@@QAE at H@Z) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	2	error LNK2005: "public: virtual __thiscall
> itk::Region::~Region(void)" (??1Region at itk@@UAE at XZ) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	3	error LNK2005: "public: __thiscall itk::Region::Region(void)"
> (??0Region at itk@@QAE at XZ) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	4	error LNK2005: "public: virtual __thiscall
> itk::ExceptionObject::~ExceptionObject(void)"
> (??1ExceptionObject at itk@@UAE at XZ) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	5	error LNK2005: "public: __thiscall
> itk::ExceptionObject::ExceptionObject(class itk::ExceptionObject const &)"
> (??0ExceptionObject at itk@@QAE at ABV01@@Z) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	6	error LNK2005: "public: __thiscall
> itk::ExceptionObject::ExceptionObject(char const *,unsigned int,char const
> *,char const *)" (??0ExceptionObject at itk@@QAE at PBDI00@Z) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	7	error LNK2005: "public: virtual void __thiscall
> itk::ExceptionObject::SetLocation(char const *)"
> (?SetLocation at ExceptionObject@itk@@UAEXPBD at Z) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	8	error LNK2005: "public: virtual void __thiscall
> itk::ExceptionObject::SetDescription(char const *)"
> (?SetDescription at ExceptionObject@itk@@UAEXPBD at Z) already defined in
> DicomImageViewer.obj	ITKCommon.lib
> Error	9	error LNK2001: unresolved external symbol "public: static double
> const itk::NumericTraits<double>::Zero"
> (?Zero@?$NumericTraits at N@itk@@2NB)	DicomImageViewer.obj
> Error	10	fatal error LNK1120: 1 unresolved
> externals	N:\Will\CERR\ITK\TestBed\DicomImageViewer-binary\Debug\DicomImageViewer.exe	1
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 


More information about the Insight-users mailing list