User Tools

Site Tools


info:eclipse

Eclipse

Note: some of this page is pretty old.

See also PyDev.

Positive

  • Overall seems to be the closest feature-wise to what I want (varies based on the language plugins)
  • The code editor works as I expect it to. Maybe that's because I've used it a lot.

Negative

  • It's slow, and a memory hog.

Preferences

General

  • General
    • Workspace
      • Refresh on access (refresh file when accessed if it is out-of-sync)
      • Text file encoding (UTF-8)

Key Bindings

Preferences → General → Keys

CommandBinding
Build ProjectCtrl+B
Commit (Subclipse)Ctrl+Alt+C

Maybe:

CommandBinding
File SearchCtrl+H
References in ProjectCtrl+Shift+G

PyDev

  • Editor
    • Under "Appearance color options", change "Comments" color to something more readable (e.g. #965F00, or perhaps something green-ish).
    • Typing
      • (unchecked) After '(' indent to its level

Run/Debug

  • Launching
    • Always launch the previously launched application

Search Page Selection

Go to Search menu → Search (Ctrl+H), click the "Customize…" button

Check "Remember last used page" and/or deselect unwanted search pages.

Eclipse 4.x CSS

See:

I installed the CSS editor, but the changes I made seemed to mostly go away after restart (trying to make the tabs smaller).

Plugins

Some of the plugins that I might normally install

  • Open terminal / file manager
    • Easy Shell
    • Aptana Studio (and the Eclipse plugin) has "open in terminal" support built-in
  • AnyEdit - things like tabs ↔ spaces, case manipulation (upper, lower, camel), compare with clipboard
  • Aptana?
  • Extended VS Presentation - interesting "skin" with some nice options (doesn't work with 4.x)

Extras from Eclipse Core Repositories

  • C/C++ Unit Testing Support
  • Linux Tools (may be included in latest C++ download)
    • C/C++ Library API Documentation Hover Help
    • RPM Specfile Editor
    • Valgrind Tools Integration

Version Control

  • Subclipse or Subversive (I've had intermittent issues with Subversive, so I normally use Subclipse)
    • Subclipse: use update site directly (instead of Eclipse Marketplace) for SVNKit and JNA library

Language / Syntax Support

    • Make sure to get the right update site for the latest update; last I check it was http://cmakeed.sourceforge.net/eclipse/ (there was also an alternative site, and a 3rd site that had an old version)
    • I recommend changing the comment color to something darker (e.g. #B76407)
    • Seems to have inferior highlighting ability (as of 2010-04-08); e.g. with this:
      while [ $# -gt 0 ]; do

      everything after the # gets treated as a comment.

Subversive and Subclipse

Issues with Both

  • Neither has a good quick "svn diff" feature. In Subclipse, the commit dialog usually suffices. Something like the TortoiseHg workbench or at least the Mercurial or Bazaar graphical diff tools would be greatly appreciated.
  • Both show diffs with the new (working copy) on the left and the old (repository copy) on the right. It should be the other way around.

Subclipse

  • I like the commit dialog, that you can see the tree and the diff view in a single window.
  • History view is annoying; can't seem to easily diff files (not sure if it's that much better with Subversive)
  • I don't particularly like how a folder shows the "dirty" icon just because it has unversioned files (though I can see how it could be useful)
    • In once installation, this doesn't seem to be the case; not sure if I disabled it somehow or what

Subversive (Eclipse.org project)

  • It's annoying to have to install the connectors separately (install Subversive, restart Eclipse, install connectors, restart Eclipse)
  • The commit dialog is annoying for diffs; I'm always having to resize the window each time to make it big enough
  • For directories neither in SVN nor ignored, it would be nice to just see the top level (the directory) instead of all the files recursively

Switching

It seems that the "attachment" to either Subclipse or Subversive is stored in the workspace, not with the project. Specifically it seems to be in the project's directory in .metadata/.plugins/org.eclipse.core.resources/.projects in a binary file.

Neither makes it easy to switch between them within the same workspace; the Team→Share menu item is missing when attached to the other provider.

The ways I've found so far to switch from one to the other are:

  • Disconnect from one, reconnect ("Share") with the other (requires you to have the old plugin installed)
  • Delete the project reference from the workspace (without deleting the files) and re-import it (File→Import, General→Existing Projects into Workspace); this may automatically attach the project, or at least will allow it to be attached with "Share"

It does appear to be possible to have both installed at once, though it's confusing (they're both called "SVN", e.g. in the Share dialog and the Preferences window). I'm not sure if this would cause any problems.

CDT (C/C++)

Remote Debugging (C++)

To debug an application remotely, we run gdbserver on the "target machine", then connect to it with gdb running on the "host machine".

On RHEL5, gdbserver is provided the the gdb package. On RHEL6 and RHEL7, it is in the gdb-gdbserver package.

References:

Manual Remote Debugging

Start the application under gdbserver (similar to starting in gdb):

gdbserver host:<port> <program> <arguments...>

For example:

gdbserver host:2345 emacs foo.txt

To attach with gdb or ddd, start the debugger against the binary as usual, then run this command in the console, providing the target hostname/IP and port:

target remote <target hostname or IP>:<port number>

To attach with Eclipse:

  1. Create a "C/C++ Remote Application" debug configuration
  2. Enter the location of the binary
  3. At the bottom, change the launcher (by clicking "Select" and choosing "Use configuration specific settings") to "GDB (DSF) Manual Remote Debugging Launcher"
  4. In the "Debugger" tab, under the "Connection" sub-tab, enter the hostname/IP and port number
  5. Start gdbserver manually as described above
  6. Start the Debug session to connect

Automatic Remote Debugging

"Automatic Remote Debugging" (added in CDT 8; see http://wiki.eclipse.org/CDT/User/NewIn80#C.2FC.2B.2B_Remote_Application_launch), will automatically copy the binary to the remote machine and launch it (starting gdbserver on the target host). For this to work, you must install the "C++ Remote Launch" component, as well as "Remote System Explorer".

This is an example of how the debugging configuration will look when "Automatic Remote Debugging" is enabled:

Hiding Things from the CDT Parser

Sometimes it can be useful to hide syntax that CDT's parser doesn't understand. You can do this with the preprocessor by checking for the __CDT_PARSER__ symbol.

For example, Eclipse may have problems the Boost "for each" macro, so in one case I gave it an alternate definition that Eclipse could more easily understand:

#ifdef __CDT_PARSER__ // Fix Eclipse CDT parsing error
    #define BOOST_FOREACH(a, b) for(a : b)
#endif

Workspace Notes

Sometimes workspaces get corrupted or crufty and need to be discarded.

It may be possible to move projects from one workspace to another by copying the files in <workspace>\.metadata\.plugins\org.eclipse.core.resources\.projects\. See https://stackoverflow.com/questions/251116/where-in-an-eclipse-workspace-is-the-list-of-projects-stored.

Problems / Fixes

[Fixed?] Completion for Headers Doesn't Work

In Eclipse 3.6, but I think it's been fixed.

If it doesn't work, go to Preferences, C/C++, Editor, Content Assist, Advanced; click Restore Defaults.

Subversive Key Bindings Don't Work

See Eclipse Bug #309074.

To make them work, go to the Customize Perspective dialog. In the Command Groups Availability tab, check "SVN". You may want to disable SVN (or some of the buttons) in the Tool Bar Visibility tab if you want reduce toolbar clutter.

Ctrl+Shift+F Doesn't Work

This shows up with 3.6, but it seems to be okay in 3.5. Maybe there was some change in the input code.

Apparently some versions of GTK+ use Ctrl+Shift+<hex> to enter unicode characters. This manifests in Eclipse when you use a shortcut Ctrl+Shift+[A-F0-9]: it shows the letter/number underlined, clears the selected text, and the bound command is not activated.

It looks like setting the environment variable GTK_IM_MODULE to xim will fix it.

CDT Indexing Crash with Certain Java Versions

SIGSEGV, mentioning org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics.declaredBefore.

Seems to be related to Red Hat Bug 647737, but it crashed for me even though I was using the Sun JDK (on Ubuntu 10.10, Eclipse 3.6).

Adding the line:

-XX:-UseCompressedOops

to eclipse.ini seemed to fix the issue for me.

"symbol could not be resolved" on all symbols in new project

I can't figure out what causes this, but it's extremely annoying. It seems to go away after I create a new .cpp file and use the symbols there.

Locking Up For Long Periods (Unsolved)

On one particular development machine, Eclipse is locking up quite often, with 100% CPU, for about 5-10 seconds at a time.

Additionally, "Mark Occurrences" is working very slowly, if at all.

Configuration:

  • RHEL5
  • Eclipse 3.7 with usual plugins

Tried so far:

  • New workspace, imported subset of projects (no change)

Theories:

  • Indexing issues
  • Something about the particular files I'm working on is weird (one in particular takes a long time to compile)
  • Some plugin going haywire

Debugger Not Working / Debugger Hangs

With some (but not all) applications, stepping or even continuing will hang the debugger–top shows gdb at 100% CPU–for a long time.

Theory: possibly the version of gdb (see e.g. Eclipse bug #324522). The version in this case is 7.0.1-42.el5.centos on CentOS 5. Going to try compiling the latest gdb 7.4.1.

Result: gdb 7.4.1 does appear to resolve this particular issue.

Disappearing SVN/Subclipse Label Decorations

The setting is Preferences, General, Appearance, Label Decorations, under which there is an "SVN" checkbox. Sometimes this checkbox gets unchecked, possibly even immediately after clicking okay.

It may be useful to look at the Error Log view (Window → Show View). In one particular case, this was caused by an incorrect SVN path.

Here is one mailing list thread about the issue: http://old.nabble.com/Label-decoration-getting-disabled-td14489747.html

C++ Completion Not Working (Solved?)

The code analysis appears to be working (e.g. shows an error if methods are misspelled), but Ctrl+Space always produces "No Default Proposals".

I was able to re-enable completion by going to "Preferences, C/C++, Editor, Content Assist, Advanced" and clicking "Restore Defaults". The "Parsing-based Proposals" kind was disabled; I don't know how it got that way.

SVN Negotiate Authentication Failed (Workaround)

svn: Commit failed (details follow):
svn: Negotiate authentication failed: 'No valid credentials provided'

I was only able to get it working by using the JavaHL bindings instead of SVNKit. In Ubuntu/Mint, install libsvnclientadapter-java. On RHEL, subversion-javahl (or if using CollabNet Subversion, make sure its lib directory is on your library path).

Hang on startup

Several possible solutions. Most likely there's something wrong with the workspace, so if all else fails, try creating a new one.

Several ways of fixing a workspace are given here: https://stackoverflow.com/questions/207843/how-do-i-prevent-eclipse-from-hanging-on-startup

Update Notes

Sometimes it's a big hard to find the release notes. I think they're always be available in the included help files. For CDT, there are usually links from http://wiki.eclipse.org/CDT.

Eclipse 3.7 Indigo (2011-06)

Platform

  • "Lightweight refresh on access": see Preferences → General → Workspace (refresh file when accessed if it is out-of-sync)
  • Import and export of installed plugins
  • Shift+Enter for quick backwards search in Find/Replace dialog

CDT

http://wiki.eclipse.org/CDT/User/NewIn80 (also in the online help)

  • Override marker symbols
  • Camel case completion (e.g. type "FB" and invoke completion to get FooBar/FOO_BAR/Foo_Bar)
  • More code style/formatting options
  • More code templates
  • Codan: quick fixes to create variables
  • "Toggle Function Definition" (refactoring) moves functions between header and source
  • In build console, warnings and errors are now highlighted in different colors
  • Supports debugging a binary (local or remote) without creating a project
  • Supports GDB 7.x pretty-printing (requires setup)
    • Update docs show how to get it working for STL
    • Use GDB 7.2; can configure path to GDB in new preferences dialog: Preferences→C/C++→Debug→GDB
  • "Automatic Remote Debugging" that copies the application to the target and runs gdbserver

Eclipse 3.8 (2012-06)

This was released along with Juno (4.2) and does not have a codename.

Builds are available at http://download.eclipse.org/eclipse/downloads/eclipse3x.html. Only the SDK build is available (as opposed to the various flavors), but of course the necessary plugins should be downloadable as usual.

PyDev author Fabio Zadrozny says, "stick with Eclipse 3.8". He mentions that Aptana Studio 3 is also good.

Eclipse 3.8 vs 4.2 (Andrey Loskutov, author of VS Presentation plugin, AnyEdit Tools, and other Eclipse plugins)

Eclipse 4.2 Juno (2012-06)

Platform 4.2

Probably on the internet somewhere, but I found it in the Eclipse help (What's New on the welcome screen).

  • GUI updates
    • Editor detachable to its own window

CDT 8.1

http://wiki.eclipse.org/CDT/User/NewIn81

  • Ability to filter outline view
  • Some new refactoring preferences
  • Mouse hover shows deduced type for "auto" keyword
  • External code analysis (Cppcheck)
  • Option to do parallel make
  • Breakpoint features improved
  • Option for a timeout for gdb commands
  • Show actual type of pointers (GDB 7.5)
  • Build variables support in launch configuration
    • Maybe useful for using Eclipse configurations to manage different CMake builds
  • Unit testing GUI

Problems

  • Tooltips on toolbar buttons are missing
  • Seems very sluggish over SSH X forwarding compared to the previous version (which was already very sluggish)
    • Doesn't seem as bad over VNC, but that has its own problems
      • 2013: I've been using mostly VNC since moving to a Windows base machine
    • Could be a network issue (it's tougher than the previous version; we still don't have gigabit to our desks)
    • SSH compression ("-C" option) may help; need to test more

Eclipse 4.3 Kepler (2013-06)

Problems

Platform

  • Search dialog can be configured to remember the last-used page (press "Customize…")
  • Improvements to "shared install" (running from a read-only folder)

CDT 8.2

http://wiki.eclipse.org/CDT/User/NewIn82

  • Organize Includes to add missing include statements, remove unused ones, and reorder them
  • Line wrap option in build console
  • "Preprocessor Include Paths, Macros etc." property page now fully replaces older "Scanner Discovery" page. "Scanner Discovery" is now hidden by default.
  • Project-relative paths for some things is now supported in the UI
  • Better content assist in Makefile editor
  • Lots of debugger updates
    • Step into selection (right click menu, or Ctrl+Alt+Click)
  • Process exit code shown in console

CDT 8.3 (Kepler SR2)

http://wiki.eclipse.org/CDT/User/NewIn83

  • Some indexer / content assist support for Qt

Eclipse 4.4 Luna (2014-06)

CDT 8.4

http://wiki.eclipse.org/CDT/User/NewIn84

Requires JRE >= 1.7.

  • "Dynamic printf" with GDB 7.7
  • Showing return value of method after a step-return
  • "Tracepoint" improvements (record values for observation without pausing execution); see FAQ entry
  • Standalone debugger (i.e. start Eclipse with just the CDT debugger); see https://wiki.eclipse.org/CDT/StandaloneDebugger
  • Support for C++ Attributes

Eclipse 4.5 Mars (2015-06)

Eclipse Mars New and Noteworthy

  • Docker management
  • Apache Cordova integration
  • Installer

CDT 8.7

https://wiki.eclipse.org/CDT/User/NewIn87 (there were some additional releases during the year)

  • Docker: built-in support for launching a C++ application in a container
  • CDT Standalone Debugger can be downloaded separately
  • Initial Arduino C++ support
info/eclipse.txt · Last modified: 2015-09-21 22:36 by sam