[Insight-users] ITK/Eclipse configuration problem

Fleming, Matthew mfleming at mcw.edu
Mon May 21 09:50:49 EDT 2007


Yes, you are quite correct, the problem was that the programs were being compiled without the -g flags. If I add the "-g" flag to CMAKE_CXX_FLAGS, I am able to debug. 

What seems odd to me is that the -g flag is left off even if CMakeLists.txt includes 'SET(CMAKE_BUILD_TYPE "Debug")'.

Perhaps the author of http://www.cmake.org/Wiki/CMake_Editors_Support (Mike Jackson) could have a look at this -- I have cc'd him this message. There seem to be one or two other errors in that page anyway, it doesn't quite work if you follow the directions because the directories aren't specified quite right. Ideally it would be possible to incorporate a CMake project into Eclipse so that there would be both Debug and Release configurations -- this seems to be what Eclipse does automagically for Managed Make Projects. Probably there is no easy way to make this happen with a CMake project. Anyway, I have the CMake book on order, and hope to understand the problem better once it arrives.

Thanks to you and Mr. Jackson for your assistance.

Matthew Fleming

-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Sat 5/19/2007 5:05 PM
To: Fleming, Matthew
Cc: insight-users at itk.org
Subject: Re: [Insight-users] ITK/Eclipse configuration problem
 

Hi Matthew,

 From your description it seems that the Debug compilation
flags are not making it into the Makefile.

Please do a recursive grep in the project directory in
search of the "-g" flag in the Makefiles.

You can also take the resulting executable, and try to
run it from gdb or ddd to see if you manage to set
breakpoints. If breakpoints don't work in gdb or ddd
then your executable was probably built without -g.

As a temporary fix, you can simply add the "-g" flag
to the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS.


    Please let us know what you find.


      Thanks,


       Luis


----------------------
Fleming, Matthew wrote:
> Folks,
> 
> I would like to use Eclipse for ITK programming. (I am new to both, so if the following has an obvious solution that I have missed, please excuse me.) I installed Eclipse with CDT and the CMake plug-in, as well as ITK, on Ubuntu Linux. I then used the example from InsightToolkit-3.2.0/Examples/Installation, building the Makefile with CMake and importing the project into Eclipse as a "Standard C++ Makefile Project". In this, I was basically following the instructions from http://www.cmake.org/Wiki/CMake_Editors_Support.  Everything worked as advertised, except for one problem; I was able to use CMake from within Eclipse to regenerate the Makefile and clean, build, and run the HelloWorld application. The problem is that debugging doesn't quite work. When I start the debug, execution stops at the beginning of the program, and when I then press the "Resume" button, it runs to completion, even if breakpoints are set. Presumably this problem has a simple solution, but I've been 
looking at it for awhile now, and can't determine what it is. Any suggestions would be much appreciated.
> 
> I've included the contents of my CmakeLists.txt below.
> 
> Thanks,
> 
> Matthew Fleming
> 
> # This project is designed to be built outside the Insight source tree.
> PROJECT(HelloWorld)
> 
> # Find ITK.
> FIND_PACKAGE(ITK REQUIRED)
> IF(ITK_FOUND)
>   INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
> 
> IF(CMAKE_COMPILER_IS_GNUCC)
>   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
> ENDIF(CMAKE_COMPILER_IS_GNUCC)
> IF(CMAKE_COMPILER_IS_GNUCXX)
>   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
> ENDIF(CMAKE_COMPILER_IS_GNUCXX)
> 
> SET(CMAKE_VERBOSE_MAKEFILE ON)
> 
> SET(CMAKE_BUILD_TYPE "Debug")
> 
> 
> ADD_EXECUTABLE(HelloWorld HelloWorld.cxx )
> 
> TARGET_LINK_LIBRARIES(HelloWorld ITKCommon)
> _______________________________________________
> 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