Using the Eclipse IDE to work on Rosegarden

Older Versions

These instructions are for the cmake build system introduced November 2015.

Instructions for working with older versions of Rosegarden can be found on these pages:

Building Rosegarden from Source

Follow the steps on the Building Rosegarden from Source page to get a copy of the source to work with.

Install Eclipse

The Eclipse IDE can be downloaded here:

I download the Linux C/C++ version which is usually called something like “Eclipse IDE for C/C++ Developers”. It's just a tarball you can expand and then look for the “eclipse” directory with the “eclipse” binary. That's pretty much it.

NOTE: If you upgrade your OS, it's a good idea to wipe out your Eclipse install and start fresh. There are config files within the Eclipse install directory that can get out of sync and cause trouble with a new OS.

Set Up Rosegarden Source Under Eclipse

Note: These instructions were developed using Eclipse 2021-03 (4.19.0).

Eclipse prefers a directory structure with a top level for the workspace and a lower level for the project. Something like this:


So, you'll want to create a new rosegarden-workspace directory and move rosegarden-git into it. Assuming you are in rosegarden-git:

$ pwd
$ cd ..
$ mkdir rosegarden-workspace
$ mv rosegarden-git rosegarden-workspace

Unfortunately, that makes a mess of cmake, so we'll need to delete any build directory and re-run cmake…

$ cd rosegarden-workspace/rosegarden-git
$ rm -rf build
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug

And now we are ready to create an Eclipse workspace and project around this directory structure.

Launch Eclipse. It will first ask for the location of your workspace. Give it the rosegarden-workspace directory that we just created. Since this is a new workspace, you'll get the Eclipse welcome screen. In the upper right is a button that says “Hide” (formerly “Workbench”). Click it.

Go to File > New > Makefile Project with Existing Code. In the “Project Name” field type rosegarden-git. For the “Existing Code Location” provide the path to the rosegarden-git directory. In the Toolchain list, select “Linux GCC”. Click Finish.

Next, Eclipse needs to know where the build directory is. Select the project (rosegarden-git) in the Project Explorer on the left side then go to Project > Properties. (There's a bug in Eclipse where sometimes this menu item is disabled. Right-clicking on rosegarden-git and picking Properties works too.) Select “C/C++ Build” on the left side. In the “Build directory:” field, add “build” to the end. The final value should be:


Click “Apply and Close” to close the project properties dialog.

You should now be able to build with Project > Build All (Ctrl+B).

To run the program, you'll need to set up a Run Configuration. Go to Run > Run Configurations. Select “C/C++ Application” and hit the New button. In the Project field, use the Browse… button to select “rosegarden-git”. In the C/C++ Application field, use the Search Project… button to select “rosegarden”. “build/rosegarden” will appear in the field.

In the Environment tab, you may want to add QT_FATAL_WARNINGS and set it to 1 so that Rosegarden will crash on signal/slot naming errors and other issues that can only be checked at runtime. [In Ubuntu 20.04 I'm getting harmless Xcb warnings in the Matrix editor that cause Rosegarden to crash. Removing QT_FATAL_WARNINGS for now. Retest at the next Ubuntu LTS release.]

Click Run to test. You should now be able to run with Run > Run (Ctrl+F11). You should also be able to debug with F11 or Run > Debug.

If you get an error about “The selection cannot be launched, and there are no recent launches,” you need to go back into the Run Configuration and hit the Run button in there to establish the first run. That will then be used each time F11 or Ctrl-F11 are pressed.

Include Files and Symbols

To make sure Eclipse is aware of the various Qt include files, we need to tell Eclipse where the Qt includes are located. Select the “rosegarden-git” project in the Project Explorer and go to File > Properties. In the “type filter text” box, type “paths” and hit enter. This should get you quickly to Paths and Symbols. Click on the “Includes” tab and then the “GNU C++” language. In the “Include directories” box, add the following:


You'll likely also want to add this non-Qt5 path:


Next, click on the # Symbols tab. Verify that “GNU C++” is still selected. In the Symbol box, add the following symbols and values:


Click “Apply and Close”.

At this point you'll want to rebuild the index. (Versions prior to Neon would prompt at this point. In case yours doesn't…) Right click on rosegarden-git in the Project Explorer and select Index > Rebuild. (This can also be accessed from the main menu: Project > C/C++ Index > Rebuild.)

It will take some time for Eclipse to rebuild the index. The “C/C++ Indexer” indicator at the bottom of the window will let you know how far along the process is.

Note: Qt4 is deprecated, but for reference, the include directories were:


Configuring Tabs

Rosegarden coding standards call for using spaces instead of tabs. To configure Eclipse, you'll need to make changes in two places.

First, the editor. Go to Window > Preferences > General > Editors > Text Editors. Here you will find an “Insert spaces for tabs” checkbox. Make sure it is checked.

Second, the code formatter. Go to Window > Preferences > C/C++ > Code Style > Formatter. Make sure the “Profile name” is “K&R [built-in]”. Click on the “Edit…” button next to the profile name. In the Indentation tab, set “Tab policy” to “Spaces only”. Change the “Profile name” to “K&R with spaces”. Click on Ok and “Apply and Close”.

Now all your tabs will be spaces.

Faster Builds

If your machine has multiple cores and/or hyperthreading, you'll want to set up make for multiple jobs (make's -j option). To do that within Eclipse, go to Window > Preferences > C/C++ > Build > Environment, add an environment variable MAKEFLAGS, and set it to “-j4” (or whatever is best for your hardware, the nproc command will tell you how many cores you've got). This will tell make that it can run four simultaneous compiles.

Scalability Mode

With large source files, many of Eclipse's features are disabled by something called “scalability mode”. Since Rosegarden has some rather large source files, this can be a problem. To adjust, go to Window > Preferences > C/C++ > Editor > Scalability. Increase the “number of lines” field from 5000 to 10000. If you end up seeing the scalability mode alert dialog, you can always increase this number even further.

Auto-Save Before Build

By default, Eclipse doesn't automatically save your files when you build. If you would prefer that behavior, go to Window > Preferences > General > Workspace > Build. Set the “Save automatically before manual build” checkbox. This avoids build errors if you forget to save a file that you've changed.

Unlimited Run Console Buffer

By default, Eclipse limits debug console output to 80,000 bytes. Rosegarden generates a lot of debug output. It's a good idea to turn this limit off. Go to Window > Preferences > Run/Debug > Console. Uncheck “Limit console output”.

Massive Build Console Buffer

By default, Eclipse limits build console output to 500 lines. This is not sufficient when things go wrong in template-land. Go to Window > Preferences > C/C++ > Build > Console. In the “Limit console output (number of lines)” field, enter 50000.

Search Editor Reuse

By default, Eclipse reuses the current editor window when you double-click on a search result. That means you might lose what you were looking at. To turn this off, go to Window > Preferences > General > Search. Uncheck “Reuse editors to show matches”.

Upgrade Notes

When upgrading to a new version of eclipse, it's a good idea to delete all the Eclipse config files in your workspace and project so the new version can start fresh. You'll have to go through all the configuration again, but things should be a bit more stable. Here's a list of key things to delete. Some of these might not exist depending on which version of Eclipse you are using.


Ubuntu Unity Icon

There appear to be two main ways to create an application icon in the Unity dash. The easiest is to create an eclipse.desktop file. The other way involves installing a GUI tool and using it.


Applications appear in the Unity dash based on .desktop files found in /usr/share/applications. Here's a sample /usr/share/applications/eclipse.desktop file for Eclipse:

[Desktop Entry]
Name=Eclipse CDT
Comment=Eclipse IDE for C/C++

You'll need to adjust the “<path-to-eclipse>” to point to where you expanded Eclipse.


If you prefer a GUI, you can try the GNOME desktop item editor:

sudo apt-get install gnome-panel
sudo gnome-desktop-item-edit /usr/share/applications --create-new

Give it the name “Eclipse”. Point it to the eclipse binary in the eclipse install directory. And finally, use the icon that is in the eclipse install directory. Click close, and Eclipse will now appear in the dash.

For more details, check out the following links:

High CPU Usage (Ubuntu 16.04 and Eclipse Mars)

This is a known issue with gtk3. Solution is to fall back to gtk2:

Black on Black Tooltips (Ubuntu 11.10)

When you hover over an identifier in Eclipse, you'll get a tooltip that provides some helpful information about that identifier. However, with Ubuntu 11.10's Ambiance theme, the tooltip background color is black, and Eclipse doesn't handle this correctly. It tries to display black-on-black text, which is just a little tough to read.

First, make sure you are using the Ambiance theme. Go to System Settings > Appearance and note that the theme in the lower right is “Ambiance”.

What about the other Ubuntu 11.10 themes? Radiance has the same problem. The HighContrast theme does not have this problem, but it's really ugly. And while HighContrastInverse does at least provide almost readable black on blue tooltip text, it is also pretty ugly. So, to avoid hacking anything, you could try HighContrast. But I'm betting you won't like it.

The solution I use is to hack the Ambiance theme to change the tooltip foreground color to black and the background color to white. To do this, you'll need to edit the following three files:


Search within those files for “tooltip” and you should find “tooltip_bg_color” and “tooltip_fg_color”. The syntax of each of these files is a little different, but should be pretty clear. Just change tooltip_bg_color to #ffffff and tooltip_fg_color to #000000.

You might need to log out and back in, but once these changes are picked up, tooltips in Eclipse will work fine.


dev/eclipse.txt · Last modified: 2024/01/05 00:38 by tedfelix
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki