Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 7 (modified by bknecht, 11 years ago) (diff)

Tips on using Eclipse

Eclipse is a complex IDE for Java and takes some time to get into. However its flexibility and the way Eclipse is easily extendable with plugins, makes it a powerful IDE for any software development.

To use Eclipse to develop Orxonox you need to install C++ support for Eclipse. This is VERY easy as it is provided via the CDT (C/C++ Development Tooling) plugin.

For Ubuntu

The current version of Ubuntu includes Eclipse Indigo (version 3.7.2) and a package that provides the CDT plugin. Just type:

$ sudo apt-get install eclipse-cdt

For Tardis @ ETH

I asked ISG to upgrade to the newest Eclipse Juno (version 4.2) and to pre-install the CDT plugin. Be sure to start it with

$ eclipse-4.2

For everybody else

Note: The CDT plugin requires at least Eclipse version 3.6 and some newer versions of the plugin require version 3.7. Be sure you have a recent enough version of Eclipse installed on your system.

Open Eclipse and choose Help->Install New Sofware.... A window will open where you can add a repository for the CDT plugin. Enter http://download.eclipse.org/tools/cdt/releases/juno (or indigo or helios depending on your version of Eclipse) and press Add.... Give the repository a nice name and proceed.

Eclipse will access the repository and provide you with a list of features the repository provides. Choose at least the Main Features and click Next >.

Eclipse will now check the dependencies and if the plugin can be installed. If not it will provide a helpful error message. If yes, proceed and Eclipse will install the CDT plugin. Afterwards you will be asked to restart Eclipse.

Make Orxonox an Eclipse project

Since Eclipse doesn't like build directories as sub directories of the source directory you need to create your build directory on the same level as your source:

$ cd ~/orxonox
$ ls
trunk
$ mkdir build
$ cd build
$ cmake -G"Eclipse CDT4 - Unix Makefiles" ../trunk

This will create an Eclipse project in your build directory.

Import to Eclipse

Open Eclipse and choose File->Import, then General->Existing Projects into Workspace.

Navigate to your build directory and Eclipse will find a project with the name Orxonox-Debug@build or something similar, depending on your settings in CMake.

Press Finish and there you go: An Orxonox project in Eclipse with many of the nice features that a C++ IDE and Eclipse provide.

Setting up Eclipse for Orxonox

Now that you have Orxonox in Eclipse you probably want to activate the C++ perspective in Window->Open Perspective->C/C++

Add a Run Configuration

To be able to run orxonox directly out of Eclipse (Ctrl+F11), you need to add a new run configuration.

  • Right-click on your project root directory Orxonox-Debug@build
  • Open Run/Debug Settings
  • Click on New…C/C++ Application
  • The launch configuration name cannot contain the @ it currently does, so rename it to something else
  • On the Main tab click on Search Project… and select orxonox from the bottom of the list
  • Click OK to save your changes

Hide all that junk in the Project Explorer

As you see in the Project Explorer there are all our generated directories plus our source directory called [Source Directory]. To avoid confusion if our source is in src or the [Source Directory] we should hide unnecessary folders and files.

Go to Project->Properties->Resource->Resource Filters and choose Add Group.... In the new window choose Include Only, Folders and Files and OR.

Now add two filters within this group where name matches [Source Directory] and bin.

Apply the filters and all but the two important directories are left.

But I like vim so much better!

No problem. Eclipse has several plugins to choose from to generate a vim experience. You can for instance install Vrapper similarly like you installed the CDT in a previous step.

Note: Unfortunately this doesn't work on Tardis as you can't install plugins yourself. If you really need this, ask ISG:EE to install the plugin for you.

There is also Eclim if you prefer a more hardcore vim plugin.

Orxonox Code Formatting Style

In order to have a unified formation in all orxonox classes, add the orxonox style.

  • Click on Window → Preferences
  • Select C/C++ and its subitem Code Style
  • Click on Import and select the xml file attached here.
  • Click on Apply and Ok

Learn more about Eclipse

http://www.vogella.com/articles/Eclipse/article.html

Attachments (1)

Download all attachments as: .zip