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.
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.
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
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.
Press next in the following screens since eclipse begins to download
the plugin.
When it finish downloading, it will ask you for confirmation
to install the extension.
When the installation finishes you have to restart eclipse.
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.
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:
- main.cpp
- testApp.cpp
- testApp.h
This are actually your project source code.
Inside the bin directory, you will find the built
executable.
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.
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.
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
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.
To create your own project, just copy one of the examples, and
paste it in the workspace.
Select the name you want for your project.
Edit testApp.cpp and testApp.h to
create your own
Openframeworks application.
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.
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.
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.