[Insight-users] Re: FltkImageViewer Problem
Luis Ibanez
luis.ibanez at kitware.com
Wed, 18 Feb 2004 20:42:45 -0500
Hi Andy,
Thanks for sending your CMakeLists.txt file.
It seems that you are missing to add the FLTK
libraries in your LINK_LIBRARIES command:
You now have:
>>>LINK_LIBRARIES (
>>> ITKBasicFilters
>>> ITKIO
>>> ITKFltkImageViewer
>>>)
>>>
Please add ${FLTK_LIBRARIES}
It should look like:
LINK_LIBRARIES (
ITKBasicFilters
ITKIO
ITKFltkImageViewer
${FLTK_LIBRARIES}
)
This variable contains a string with the
names of the four FLTK libraries.
Regards,
Luis
---------------
Andy Eow wrote:
> Hi Luis,
>
> Thanks for your quick response.
>
> The lines you've suggested were already included in the first e-mail and
> still I got the errors. I've attached my CMakeLists.txt and Makefile for
> your reference. Please advise.
>
> Cheers,
> Andy
>
>
> ----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Andy Eow" <eow at ai.mit.edu>
> Cc: <Insight-users at itk.org>
> Sent: Tuesday, February 17, 2004 3:16 AM
> Subject: Re: FltkImageViewer Problem
>
>
>
>>Hi Andy,
>>
>>You are missing to include the configuration
>>for FLTK. Please add the following lines to
>>your CMakeLists.txt file:
>>
>>
>> FIND_PACKAGE(FLTK)
>> IF(FLTK_FOUND)
>> INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
>> ENDIF(FLTK_FOUND)
>>
>>then rerun CMake and provide the locations
>>of all 6 FLTK components.
>>
>>Please look at the FAQ for details
>>
>>
>
> http://www.itk.org/cgi-bin/InsightFAQ/InsightFAQ?req=show&file=faq03.005.htp
>
>>
>>
>>Regards,
>>
>>
>>
>> Luis
>>
>>
>>
>>----------------------
>>
>>Andy Eow wrote:
>>
>>
>>>Hi Luis,
>>>
>>>I'm interested in writing a modified version of the DicomImageViewer
>
> that
>
>>>comes with ITKApplications and hence want to copy the existing files
>
> into a
>
>>>separate directory [/home/Code/DICOMViewer] for reference. However, I
>
> have
>
>>>not been able to get DicomImageViewer to compile in the new directory
>
> after
>
>>>copying. Read a previous post with the subject [Insight-users] Re:
>>>/usr/bin/ld: cannot find -lITKFltkImageViewer and added the few lines to
>
> my
>
>>>CMakeList.txt. Solved a few problems but gives the following error now:
>>>
>>>Building dependencies. cmake.depends...
>>>-- Using Buildname: Linux-i686-pc-linux-gnu-g++
>>>-- Loading VTK CMake commands
>>>-- Loading VTK CMake commands - done
>>>Building object file DicomImageViewer.o...
>>>Building executable /home/Code/DICOMViewer/DicomImageViewer...
>>>DicomImageViewer.o(.text+0xc8): In function `main':
>>>: undefined reference to `fl_file_chooser(char const*, char const*, char
>>>const*, int)'
>>>DicomImageViewer.o(.text+0x2c3): In function `main':
>>>: undefined reference to `Fl::run()'
>>>
>
> DicomImageViewer.o(.gnu.linkonce.t._ZN4fltk13Image2DViewerIfE8SetImageEPKN3i
>
>>>tk5ImageIfLj2EEE+0x294): In function
>>>`fltk::Image2DViewer<float>::SetImage(itk::Image<float, (unsigned)2>
>>>const*)':
>>>: undefined reference to `Fl_Valuator::value(double)'
>>>
>
> DicomImageViewer.o(.gnu.linkonce.t._ZN4fltk13Image2DViewerIfE8SetImageEPKN3i
>
>>>tk5ImageIfLj2EEE+0x2ac): In function
>>>`fltk::Image2DViewer<float>::SetImage(itk::Image<float, (unsigned)2>
>>>const*)':
>>>: undefined reference to `Fl_Valuator::value(double)'
>>>
>
> DicomImageViewer.o(.gnu.linkonce.t._ZN4fltk13Image2DViewerIfE11RenderImageEd
>
>>>d+0x3c6): In function `fltk::Image2DViewer<float>::RenderImage(double,
>>>double)':
>>>: undefined reference to `Fl_Widget::redraw()'
>>>
>
> DicomImageViewer.o(.gnu.linkonce.t._ZN4fltk13Image2DViewerIfE11RenderImageEd
>
>>>d+0x3cb): In function `fltk::Image2DViewer<float>::RenderImage(double,
>>>double)':
>>>: undefined reference to `Fl::check()'
>>>
>
> /home/InsightToolkit-1.4.0/Applications/InsightApplications/Auxiliary/FltkIm
>
>>>ageViewer/libITKFltkImageViewer.a(fltkImage2DViewerGUI.o)(.text+0x23b):
>
> In
>
>>>function `fltkImage2DViewerGUI::fltkImage2DViewerGUI[not-in-charge]()':
>>>: undefined reference to `Fl_Group::end()'
>>>
>>>The list of errors go on pretty long so I've only attached a sample
>
> here.
>
>>>I'm pretty sure that the necessary libraries are present because I was
>
> able
>
>>>to compile and run the DicomImageViewer that came with ITK. I'm guessing
>>>it's a path problem but I'm not too sure how to go about solving it.
>
> Please
>
>>>advise.
>>>
>>>Thank you very much.
>>>
>>>Cheers,
>>>Andy
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
>>PROJECT(DICOMViewer)
>>INCLUDE_REGULAR_EXPRESSION("^.*$")
>>
>># Tell CMake's FIND_PACKAGE command where to look for our Find<pkg>
>># modules.
>>SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ITK_DIR}/Applications/InsightApplications)
>>
>># Don't build anything unless the version of CMake is high enough.
>># The matching ELSE/ENDIF should be the last lines in the file.
>>IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)
>>
>>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)
>>
>># Add an option to use or not use FLTK (http://www.fltk.org)
>>OPTION(USE_FLTK "Use FLTK (The Fast Light Toolkit) for GUI (some applications need this)" ON)
>>IF(USE_FLTK)
>> FIND_PACKAGE(FLTK)
>> IF(FLTK_FOUND)
>> INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR})
>> ENDIF(FLTK_FOUND)
>>ENDIF(USE_FLTK)
>>
>># The fluid-generated fltk sources have many warnings. This macro
>># will disable warnings for the generated files on some compilers.
>>MACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS files)
>> IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
>> IF(CMAKE_COMPILER_IS_GNUCXX)
>> FOREACH(f ${files})
>> STRING(REGEX REPLACE "\\.fl$" ".cxx" SRC "${f}")
>> STRING(REGEX REPLACE ".*/([^/]*)$" "\\1" SRC "${SRC}")
>> SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS -w)
>> ENDFOREACH(f)
>> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
>> ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.6)
>>ENDMACRO(ITK_DISABLE_FLTK_GENERATED_WARNINGS)
>>
>>LINK_LIBRARIES (
>> ITKAlgorithms
>> ITKCommon
>> ITKBasicFilters
>>)
>>
>># If the version of CMake was too old, complain and build nothing.
>># These should be the last lines in this file.
>>ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)
>> MESSAGE(SEND_ERROR
>> "This version of CMake is too old to build InsightApplications. "
>> "Please upgrade to CMake 1.6.")
>>ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)
>>
>>###################
>>
>>FIND_PATH(InsightApplications_SOURCE_DIR CMakeList.txt)
>>FIND_PATH(InsightApplications_BINARY_DIR CMakeCache.txt)
>>
>>INCLUDE_DIRECTORIES (
>> ${InsightApplications_SOURCE_DIR}/Auxiliary/FltkImageViewer
>> ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
>>)
>>
>>LINK_DIRECTORIES(
>> ${InsightApplications_BINARY_DIR}/Auxiliary/FltkImageViewer
>>)
>>
>>###################
>>
>>LINK_LIBRARIES (
>> ITKBasicFilters
>> ITKIO
>> ITKFltkImageViewer
>>)
>>
>>ADD_EXECUTABLE( DicomImageViewer DicomImageViewer.cxx )