Step 1: Installing Eclipse and the C/C++ compiler
Step 2: Executing the openframeworks examples
Step 3: Creating your own project
Step 4: Moving your code
Step 5: Updating openframeworks
Step 6: Where can I find more help?

Step 1: Installing Eclipse and the C/C++ compiler


Eclipse is an open source IDE from IBM. It was designed for Java programming but also as a universal platform which can be extended to use other languages.

Among others, there are versions for Mac OS X, Windows and Linux. This howto is based in the Windows version although it must be almost the same for other platforms.

First download it from http://www.eclipse.org

Install it wherever you want. The installation is pretty straight forward.

Eclipse doesn't include a c/c++ compiler so you have to download a gcc version separately. For Windows we recomend MinGW. You can download it from sourceforge: http://sourceforge.net/projects/mingw/


sf.png

sfmigw.png

Downloading the current version of MinGW
Install it, the default path installation is c:\MinGW

Next, include it in your path. To do that, go to My PC > Properties > Advanced > Environment variables, modify Path at System variables, and add at the end of the Variable value, a ; and then the folder where the Mingw utilities are, by default c:\MinGW\bin.

env1.JPGenv2.JPGenv3.JPG
If you want to be able to debug your applications you also have to install gdb, the gnu debugger. You can download it from the MinGW page:

http://www.mingw.org/downloads.shtml

Look for the current version of bin gdb.
mingwgdb.JPG

Install it at the same location as mingw (c:\MinGW by default)

Gdb has some other debuggers appart from the c and c++ one, as g77, ada or java, you don't need to install them.
migw1.JPG
After installing eclipse and MinGW, you have to install C/C++ support for Eclipse. Start Eclipse and go to Help > Software Updates > Find and Install.

You can update or install new features, choose Search for new features to install

Eclipse Update


Installing new features

There are several extension repositories, the C/C++ plugin is in the Callisto Discovery Site

So, select it, and press next

Then select the C and C++ Development plugin.

The Callisto Discovery Site

The C and C++ Development plugin

Press next in the following screens since eclipse begins to download the plugin.

Downloading

When it finish downloading, it will ask you for confirmation to install the extension.

Install

When the installation finishes you have to restart eclipse.

Rstart eclipse

Step 2: Executing the Openframeworks examples

As Eclipse is a multilanguage IDE it has a perspective for each language. Choosing the right perspective will change the defaults, disposition and others in Eclipse so it's easier to develop.

To change the perspective go to Window > Open Perspective > Other and choose C/C++

Eclipse use a workspace paradigm. You have a directory on your hard disk were all your projects will be stored, that is called a workspace. You can have more than one workspace. 

The Eclipse version of Openframeworks is packaged as an Eclipse workspace. In order to use it, just uncompress the zip file and open the apps directory as a workspace in Eclipse from File > Switch workspace.

You will see all the example projects at the left of the IDE.


Compiling the projects

You won't see there the Openframeworks projects, as it isn't in the apps folder, but at libs. To see it, you have to import the Openframeworks project from File > Import > General > Existing projects to workspace.

Select libs\openframeworks and press next. The openframeworks project will appear in the package explorer

If you open an example, you will see that there are 3 files in the root directory:

This are actually your project source code.

Inside the bin directory, you will find the built executable. 

Compiling the projects


To try the examples, just press with the right button of the mouse over the executable file in the bin directory and select Run As > Run Local C/C++ Aplication. If you want to debug an application, do the same but select Debug As >Debug Local C/C++ Application.

Executing an example

Some examples use external files as images, videos... When loading those kind of files in your projects, is always recomendable to use relative paths. Something like:

images/img1.jpg

not

c:\images\img1.jpg

So if you move your program to other computer or path it can find the files.

copyproject.JPG


When you run a program, it will search files with relative paths, beginning at a directory called the working directory.

In eclipse the default working directory is the root of your project, but you can change it from the Run > Run As > Run... menu option.

First, select the project you want to configure in the Main section

file:///home/art/documentos/openframeworks/eclipse/images/runselectproject.JPG

Then change the working directory in the Arguments section.

By default the Openframeworks examples uses the bin folder as working directory so for example in the fontsExample all the font files (*.ttf) are in bin.

As you can see the notation used refers to the workspace path:

${workspace_loc:fontsExample}\bin

means the bin folder in the fontsExample project in the current workspace.
file:///home/art/documentos/openframeworks/eclipse/images/runconfigwd.JPG





Step 3: Creating your own project

To create your own project, just copy one of the examples, and paste it in the workspace.


Pasting the project

Select the name you want for your project.

Renaming the project

Edit testApp.cpp and testApp.h to create your own Openframeworks application.

Step 4: Moving your code

If at any time you have to move your code to other folder, or computer, you can simply copy the app and libs directories. All the relations to the libraries are relative, so you can put it wherever you want, just tell eclipse where the new workspace is, and you will have the same configuration. To change the current workspace in eclipse, just go to File > Switch Workspace and choose the new path. Remember that the workspace is at the app directory.

Step 5: Updating Openframeworks
If you want to use a new Openframeworks version, you can just overwrite the files in the openframeworks project directly from the windows explorer or through the Import option in Eclipse. Be carefull Openframeworks is not a stable version so it can change and overwritting it can broke your projects.

If you want to mantain your old projects with the Openframeworks version you originally used, just switch your workspace to the new version apps directory.

Then you can import your old projects to the new workspace through the File > Import option. Be carefull to select the Copy projects into workspace option or you will be working over the original version.
importexistingprojectcopyproject.JPG

Another way to update openframeworks is to use subversion. There's a subversion plugin for eclipse so you can mantain up to date your openframeworks version to the very last changes. You can find the installation instructions at http://subclipse.tigris.org/install.html




Step 6: Where can I find more help
There are excellent tutorials for eclipse. Note that you are using the CDT extension for Eclipse so when looking the Internet for reference do not search just for Eclipse but Eclipse CDT.