Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Tips on using Eclipse

Eclipse is a complex IDE for Java and takes some time to get into. However it's flexible and easily extendable with plugins such as C++ support, Python support or Android SDK. This makes Eclipse a powerful IDE for any software development.

In order to use Eclipse to develop Orxonox you need to install the CDT plugin which enables C++ development.

For Ubuntu

The current version of Ubuntu includes Eclipse version 3.8.1 and a package that provides the CDT plugin. Just type:

$ sudo apt-get install eclipse-cdt

If you want the newest version you will have to install it manually.

For Tardis @ ETH

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

$ eclipse-4.2

Note: Newest version is 4.4.1

For everybody else

A. Install Eclipse

Go to the download page and choose the CDT version of Eclipse.

Note: If you want to use Eclipse for more than just C++ development, install the standard version of Eclipse and install the CDT plugin afterwards.

Eclipse comes pre-compiled and you just have to move it to where you want to use it. For Linux users it makes sense to create a symbolic link in their /usr/local/bin/ folder to the eclipse executable.

B. Install CDT Plugin

Note: This step is only necessary if you haven't already installed the CDT version of Eclipse.

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 the check fails it will provide a helpful error message. Otherwise 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

Last modified 7 years ago Last modified on Apr 12, 2017, 11:54:31 PM

Attachments (1)

Download all attachments as: .zip