[Insight-users] [insight-users] Eclipse setup : debug, viewing sources and correct project tree

Antonin Perrot-Audet antonin07130 at gmail.com
Tue Mar 9 17:14:15 EST 2010


Hello,
After spending some time configuring ITK with Xcode, I figured out that 
the code completion was not working, and as I'd like to have a 
confortable environment to code (I like to have a graphical debugger ... 
etc...), I decided to give Eclipse a try... But :

*I have (much) trouble configuring ITK with Eclipse CDT :*

1)    First of all, when I import the project I get a lot of warnings :
"
Invalid project path: Include path not found 
(/Users/antonin/[...]/Programming/ITK/Antonin/TrainEclipse/bin/(framework).    
TRAINPROJ-
"
2)    I can "build all", and get a nice executable in 
/TrainEclipse/bin/src/ which works perfectly when executed via a 
terminal, BUT, I cannot use the hammer icon : build the active 
configuration for the active project...
3)    I cannot debug, Eclipse seems not to find the executable it just 
made... The debug configuration is almost empty, and it tells me that 
there should not be an "@" in the configuration name...
4)    the generated project doesn't show my sources, it seems like the 
project root is the "build" directory, and my sources are not in the 
project tree

_Here is how I organized my sources : (there is only main.cxx for 
testing purpose)_

TrainEclipse
|
|CMakeLists.txt //content described in CMakeLists I
|
|
|--src
|    |main.cxx
|    |CMakeLists.txt //content described in CMakeLists II
|
|--lib
|    |CMakeLists.txt //content described in CMakeLists III
|
|--build
|    |(Cmake generated files for the eclipse project with the 
.project...etc...)
|

_Here are my CMakeLists :_

*CMakeLists I :*
"
# CmakeList.txt in root of project : structure of project (OMG this is 
heavy)

cmake_minimum_required(VERSION 2.6)

# Name of the project
PROJECT(TRAINPROJ)

# Project structure
# add_subdirectory (lib) for now, no lib...
add_subdirectory (src)
"



*CMakeLists II :*
"
#CmakeList.txt from the src directory

# Find ITK.
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
   INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)

# Make sure the compiler can find include files from our lib folder 
library(ies).
INCLUDE_DIRECTORIES(${TRAINPROJ_SOURCE_DIR}/lib)

# Add binary called "main" that is built from the source file "main.cxx".
# The extension is automatically found.
ADD_EXECUTABLE(main main.cxx)


# Link the executable to the library(ies). (add lib after main)
TARGET_LINK_LIBRARIES(main ITKNumerics ITKIO itkgdcm itkvcl itkvnl 
ITKAlgorithms ITKBasicFilters ITKCommon )
"



*CMakeLists III :*
"
# CmakeLists.txt in lib dir
# Adds a library called lib (liblib.a under Linux) from the source file 
lib.cpp
# ADD_LIBRARY( lib lib.cpp )
"



_And Here is how I generated the project for eclipse :_

in a terminal, from the build directory :
"
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../
"
I simply imported the project in eclipse, specifying the /build folder 
where the .project is.



Any help would be greatly appreciated,

Regards,

Antonin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100309/7774f92a/attachment-0001.htm>


More information about the Insight-users mailing list