How to have a single reference to catkin packages in generate Eclipse project?

asked 2013-11-23 15:32:16 -0600

b-adkins gravatar image

updated 2014-01-28 17:18:37 -0600

ngrennan gravatar image

How to reproduce my issue

To setup an Eclipse workspace, I followed the instructions in the IDEs page, which means I run the following command:

catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"

What happens

Eclipse creates FOUR versions of your catkin source space (the src directory under your workspace root):

  1. Each package directly under Project@build
  2. Each package in [Source Directory]
  3. Each package under [Subprojects]
  4. Each package under [Subprojects]/Project

I notice that some of these contain gtests (presumably included by cmake's add_subdirectory()) while some do not.

Why this is a problem for me

Eclipse has a lot of handy ways to jump around your code quickly:

  • Switching between headers and source files (CTRL-TAB)
  • Jumping to declarations (F3)
  • Jumping back (ALT-LEFT ARROW)
  • Opening files by name/wildcard (CTRL-SHIFT-R)

However, when I would expect Eclipse to return to an editor already open for a file (e.g. main.cpp from [Subprojects]), it opens another editor for another version of the file (e.g. main.cpp from [Source Directory]). I think different tools default to different versions?

This leads to multiple editors open for the same file, which Eclipse treats as different files. So when I make changes while jumping around like I'm accustomed to, unsaved changes end up in two editors open for the same file, and when I try to save, I get a conflict. I end up having merge them. Not fun, to correct or to avoid.

I think it also may interfere with the indexer. Which breaks parts of my workflow such as using the call hierarchy (CTRL-ALT-H) to make sure I've gotten everything when I'm refactoring.

What I would like answered

How do I only have a single version of my packages recognized by my workspace? Without having to change settings every time I rebuild it?

Is this a bug or a poorly-documented feature? If it's a bug, I'm copy-pasting this post to GitHub. If it's a poorly-documented feature, I'd like to request an entry on the IDE page.

Thanks in advance.

edit retag flag offensive close merge delete

Comments

+1 against annoyance =)

felix k gravatar image felix k  ( 2013-11-24 21:46:46 -0600 )edit

Unfortunately I don't use Eclipse, so I don't know, but generally this tends to be a CMake specific thing and not generally anything to do with catkin. You might have better luck trying to reproduce this with CMake only and posting to a CMake help site, like StackOverflow.

William gravatar image William  ( 2013-11-25 06:30:51 -0600 )edit

Did you find any solution for this? I/We are also struggling with this annoying fact!

einrob gravatar image einrob  ( 2014-08-19 08:32:27 -0600 )edit