How to have a single reference to catkin packages in generate Eclipse project?
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):
- Each package directly under Project@build
- Each package in [Source Directory]
- Each package under [Subprojects]
- 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.
+1 against annoyance =)
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.
Did you find any solution for this? I/We are also struggling with this annoying fact!