Skip to content
This repository

Setup instructions for Linux and Eclipse IDE #134

Merged
merged 4 commits into from over 1 year ago

3 participants

maiatoday arturo Kyle McDonald
maiatoday

Setup instruction showing how to get openFrameworks running in Eclipse IDE. I have tested from a clean install with both the github master branch of openFrameworks and the 0073 packaged version.

arturo
Owner

looks great! i've been always kind of dubious about adding eclipse as an option because even if it's really powerful it's also very complex and the cdt support for makefiles is somehow buggy. the instructions look really good though and simple enough.

perhaps if you could add a comment at the beginning advising that for beginners it would be easier to use codeblocks.

maiatoday

I'll add the initial comment.

There is one problem with the packaged version at the moment, the .project files are not in the zip file. To fix this I added a step to get the .project files from github. Perhaps this document should only be added to the site if these files are included. Then I can remove the extra step of pulling a .project file from github if you downloaded the tgz version.

arturo
Owner

yes i think it's better to add this for the next version, then i'll add the .project to the linux packages so people can choose among any of the possible IDEs

maiatoday

ok that's great, then I'll take that extra step out. It will make the process just a little simpler.

Kyle McDonald
Owner

omg this is awesome, really great work! congratulations! thanks for this contribution :)

Kyle McDonald kylemcdonald merged commit 84b1296 into from January 04, 2013
Kyle McDonald kylemcdonald closed this January 04, 2013
arturo
Owner

hey kyle, this isn't ready yet till we have the project files in next release as we commented in previous comments.

can you revert the commits and resend the PR? or perhaps if it's easier remove the link from the download page and send a PR to add it when 0.7.4 is released

arturo
Owner

in general if it's linux or android related please let me merge it to be sure that it's correct

maiatoday

I left the info on how to get the .project files in the FAQ section, just as a record incase someone tries this with an older tgz file after we add the .project files. Let me know if you need met to do anything.

arturo
Owner

thanks!

Kyle McDonald
Owner

hey, sorry arturo -- i read through the tutorial and it looked complete to me (due to the notes about generating the project files). but in the future i'll let you merge it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  download/index.html.mako
@@ -22,6 +22,7 @@
22 22
 	<p><a href="http://www.openframeworks.cc/versions/v${bf.config.currentVersion}/of_v${bf.config.currentVersion}_linux64_release.tar.gz">code::blocks (64 bit)</a></p><br/>
23 23
 	<h3>IDE setup guide</h3>
24 24
 	<p><a href="../setup/linux-codeblocks">code::blocks</a></p>
  25
+	<p><a href="../setup/linux-eclipse">eclipse</a></p>
25 26
 </div>
26 27
 
27 28
 <div id="download-latest-platform">
BIN  setup/linux-eclipse/01addCode.png
BIN  setup/linux-eclipse/01createTestProject.png
BIN  setup/linux-eclipse/01debugTarget.png
BIN  setup/linux-eclipse/01debugTestProject.png
BIN  setup/linux-eclipse/01downloadEclipse.png
BIN  setup/linux-eclipse/01externalTool.png
BIN  setup/linux-eclipse/01importProjects.png
BIN  setup/linux-eclipse/01importTestProject.png
BIN  setup/linux-eclipse/01setReferences.png
BIN  setup/linux-eclipse/01workspaceLauncher.png
BIN  setup/linux-eclipse/02addCode.png
BIN  setup/linux-eclipse/02debugTarget.png
BIN  setup/linux-eclipse/02externalTool.png
BIN  setup/linux-eclipse/02importProjects.png
BIN  setup/linux-eclipse/02importTestProject.png
BIN  setup/linux-eclipse/03addCode.png
BIN  setup/linux-eclipse/03debugTarget.png
BIN  setup/linux-eclipse/03externalTool.png
BIN  setup/linux-eclipse/04debugTarget.png
BIN  setup/linux-eclipse/05debugTarget.png
BIN  setup/linux-eclipse/06debugTarget.png
247  setup/linux-eclipse/index.html.mako
... ...
@@ -0,0 +1,247 @@
  1
+<%inherit file="/_templates/markdown.mako" />
  2
+
  3
+linux eclipse
  4
+=============
  5
+**Note**: see the [FAQ](#faq) at the bottom of this page if you're having trouble.
  6
+
  7
+This guide describes how to get started with openframeworks using Eclipse as IDE. Eclipse is very powerful, however it is a complex and somewhat resource heavy environment. If you are new and/or want to get started quickly, try using the [code::blocks environment][15] first.
  8
+
  9
+This guide was tested on Ubuntu 12.10 64 bit installation with Eclipse Juno(4.2 SR1) and the openFrameworks version of_v0073 for 64bit. Eclipse specific steps may apply to other platforms. 
  10
+
  11
+To use it you will need Eclipse for C++ and openframeworks.
  12
+
  13
+Summary
  14
+-------
  15
+The main steps are:
  16
+
  17
+- Install Eclipse.
  18
+- Download openFrameworks either from the download page, or clone from git.
  19
+- Create a new project using the projectGenerator tool.
  20
+- Import the openFrameworks projects into Eclipse.
  21
+- Import the new project into Eclipse.
  22
+- Set the new project properties to find referenced source.
  23
+- Set the new project build targets to allow debugging.
  24
+- Add some code to the new project to check that code complete works.
  25
+- Debug the new project to check that debug build works.
  26
+
  27
+
  28
+Installation
  29
+------------
  30
+
  31
+**a) Eclipse**: Download the C/C++ edition for your platform from the [downloads section on the Eclipse website][11].
  32
+
  33
+![download Eclipse][01downloadEclipse]
  34
+
  35
+These instructions currently use Eclipse Juno 4.2 SR1.
  36
+
  37
+There are installation [instructions on the eclipse site][1]. You need the official Sun/Oracle version of Java to use eclipse. The Java installation instructions for ubuntu referenced on this page are old and for this installation [these instructions][12] were used. For more ubuntu specific information on how to install eclipse look at the this [question and answer][13] and an [this page which shows where to put executables and how to make a launch icon][14].
  38
+
  39
+
  40
+**b) openFrameworks for linux package**: Download it from the [openFrameworks downloads page][4].
  41
+
  42
+You may also check out the openFrameworks source from [GitHub (under master branch)][9].
  43
+
  44
+- in the scripts/linux folder inside the openFrameworks package you will find a directory with the name of your distribution. There are 2 scripts, install_codeblocks.sh and install_dependencies.sh. You only need to run install_dependencies.sh. Don&#8217;t execute it from the desktop, as it needs root privileges to run, you will need to run it from a terminal. You can execute it more than once without problem if something goes wrong. If you update your openFrameworks version, execute install_dependencies.sh script again. If you are using the tar-zipped downloaded version of openframeworks, at this point, you should be able to build the examples using the makefile from the command line.  If you are using the GitHub version you will have to generate the example projects using projectGenerator if you want to run them.
  45
+
  46
+On Ubuntu the exact steps are as follows:
  47
+
  48
+__Ubuntu:__ 
  49
+
  50
+- open a terminal. If you are using unity click on the Dash icon and type term then choosing the appropriate application.
  51
+
  52
+- in the terminal go to the directory where your openFrameworks package is.
  53
+
  54
+- ie. if your user name is ofuser and you have uncompressed the oF package in the desktop it should be something like:
  55
+
  56
+        cd /home/ofuser/Desktop/of_v0073_linux64_release/scripts/linux/ubuntu
  57
+
  58
+- once in this directory run the scripts with:
  59
+
  60
+        sudo ./install_dependencies.sh
  61
+
  62
+- to check if the example works with a make file, go to the example directory and type make.
  63
+
  64
+- ie. if your user name is ofuser and you have uncompressed the oF package in the desktop try the following commands:
  65
+
  66
+        cd /home/ofuser/Desktop/of_v0073_linux64_release/examples/graphics/polygonExample
  67
+        make
  68
+        cd bin
  69
+        ./polygonExample
  70
+    
  71
+
  72
+**c) Start Eclipse**: 
  73
+
  74
+Depending on where you installed eclipse you can start it from the terminal or if you made a launcher icon start it from there. The terminal command may look like this:
  75
+
  76
+        cd /home/ofUser/opt/eclipse
  77
+        ./eclipse
  78
+
  79
+You will see a pop up asking you what workspace to use. Just point it to the default, the openframeworks projects will not end up in this workspace.
  80
+![workspace launcher][01workspaceLauncher]
  81
+
  82
+
  83
+**d) Import openFrameworks into Eclipse:** 
  84
+
  85
+File \> Import and select General \> Existing projects in the workspace...
  86
+
  87
+![import projects 1][01importProjects]
  88
+![import projects 2][02importProjects]
  89
+
  90
+Import in this order:
  91
+ 
  92
+- openFrameworks/libs
  93
+- openFrameworks/libs/openFrameworks
  94
+- openFrameworks/addons/
  95
+
  96
+**e) Create an External Tools Configuration to run the projectGeneratorSimple**
  97
+
  98
+Run \> External Tools \> External Tools Configuration
  99
+
  100
+![add external tool 1][01externalTool]
  101
+
  102
+Set the Location to 
  103
+        /home/ofUser/of_v0073_linux64_release/apps/projectGenerator/projectGeneratorSimple/bin/projectGeneratorSimple
  104
+
  105
+Set the Working directory to 
  106
+        /home/ofUser/of_v0073_linux64_release/apps/projectGenerator/projectGeneratorSimple/bin
  107
+
  108
+![add external tool 2][02externalTool]
  109
+
  110
+Run \> External Tools \> Organize Favourites...
  111
+
  112
+![add external tool 3][03externalTool]
  113
+
  114
+**f) Create a Test project**
  115
+Use the toolbar button to run the external tool or choose from the menus:
  116
+
  117
+Run \> External Tools \> ProjectGeneratorSimple
  118
+
  119
+Fill in the info for your test project
  120
+
  121
+![create a test project][01createTestProject]
  122
+
  123
+**g) Import the test project**
  124
+
  125
+In eclipse import the test project. You can right-click on the project explorer tab or choose 
  126
+
  127
+File \> Import then make sure to choose C/C++ Existing code as makefile project
  128
+
  129
+![import the test project 1][01importTestProject]
  130
+![import the test project 2][02importTestProject]
  131
+
  132
+**h) Set test project references**
  133
+
  134
+Add the references to openFrameworks in the project so that source code is visible in the test code. 
  135
+
  136
+Right click on the test project in the project browser and choose Properties. Choose C/C++ Generatl and choose the References tab. Then select both the addons and the openFrameworks projects.
  137
+
  138
+![set project references][01setReferences]
  139
+
  140
+**i) Add test project debug settings**
  141
+
  142
+The openframeworks project makefile uses the argument "Debug" to compile the code with the correct symbols to allow debugging. The executable it generates for debug ends with _debug. e.g. 
  143
+
  144
+        test_debug 
  145
+
  146
+instead of just 
  147
+
  148
+        test
  149
+
  150
+Change the project properties to use
  151
+
  152
+        make Debug
  153
+
  154
+and to use the executable
  155
+
  156
+        test_debug
  157
+
  158
+by setting up project properties. Right-click on the project in the project browser and choose Properties. Add a new Debug configuration with Manage Configurations. Set the new Debug configuration as the active configuration. Set the Builder settings to call _make Debug_. Then change the Run/Debug Settings to use the _test_debug_ executable.
  159
+
  160
+![add a debug target 1][01debugTarget]
  161
+![add a debug target 2][02debugTarget]
  162
+![add a debug target 3][03debugTarget]
  163
+![add a debug target 4][04debugTarget]
  164
+![add a debug target 5][05debugTarget]
  165
+![add a debug target 6][06debugTarget]
  166
+
  167
+**j) Add code to the test project**
  168
+
  169
+Add some code to the project. In this step you can test if code completion works with Ctrl-Spacebar. e.g. type ofL Ctrl-Space and see if the ofLog method is displayed. You can also see if Eclipse will jump to the declaration of a method or constant by pressing F3. Compile the code using the Hammer icon. For this example I added a log message to the setup method in the testApp.cpp file. Make sure you choose the Debug configuration under the arrow of the Hammer.
  170
+
  171
+![add code 1][01addCode]
  172
+![add code 2][02addCode]
  173
+![add code 3][03addCode]
  174
+
  175
+**k) Run and debug the test project**
  176
+
  177
+Activate a breakpoint in the new code by Right-click in the margin and choosing Toggle Breakpoint or double clicking in the margin. Press the green bug toolbar icon to run in debug mode. The debugger should break at your breakpoint. Use the debug controls to continue or step into the code.
  178
+
  179
+![debug the test project][01debugTestProject]
  180
+
  181
+Notes
  182
+-----
  183
+
  184
+- Data files should go in bin/data. 
  185
+
  186
+- Sometimes there are unresolved symbols which look like bugs, red squiggles. The project still compiles and runs correctly. This happens if Eclipse is confused about which symbols it should use. 
  187
+
  188
+- You can see the output of the compiler and of the ofLog commands in the Console tab.
  189
+
  190
+<a id="faq"></a>FAQ
  191
+---
  192
+
  193
+- If the Import project step does not find a project you are missing a .project file.
  194
+For openFrameworks/libs save [this file][libsProjectFile] as .project file.
  195
+For openFrameworks/libs/openFrameworks save [this file][ofProjectFile] as .project file.
  196
+For openFrameworks/addons/ save [this file][addonsProjectFile] as .project file.
  197
+
  198
+- If nothing happens when you click on the green bug to debug, you may have to choose organise favourites from the green bug arrow and add your test project configuration.
  199
+
  200
+- If you can't set a breakpoint, check carefully where in the margin you are clicking. The click target isn't all that large.
  201
+
  202
+- Sometimes it helps to refresh the symbols by Right clicking on the project and choosing Index \> Rebuild
  203
+
  204
+
  205
+[1]: http://wiki.eclipse.org/Eclipse/Installation#Install_a_JVM
  206
+[2]: http://developer.android.com/sdk/index.html
  207
+[3]: http://developer.android.com/sdk/ndk/index.html
  208
+[4]: http://openframeworks.cc/download
  209
+[5]: http://ant.apache.org/bin/download.cgi
  210
+[6]: http://developer.android.com/sdk/eclipse-adt.html
  211
+[7]: http://developer.android.com/guide/developing/device.html
  212
+[8]: http://www.multigesture.net/articles/how-to-setup-openframeworks-for-android-on-windows/
  213
+[9]: http://github.com/openframeworks/openFrameworks
  214
+[10]: http://www.undef.ch/uploads/ofDoc/html/classof_log.html
  215
+[11]: http://www.eclipse.org/downloads/
  216
+[12]: http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html
  217
+[13]: http://askubuntu.com/questions/186299/eclipse-juno-need-root-access-everytime-i-change-the-configuration
  218
+[14]: https://help.ubuntu.com/community/EclipseIDE
  219
+[15]: http://www.openframeworks.cc/setup/linux-codeblocks/
  220
+
  221
+[libsProjectFile]: https://raw.github.com/openframeworks/openFrameworks/master/libs/.project
  222
+[ofProjectFile]: https://raw.github.com/openframeworks/openFrameworks/master/libs/openFrameworks/.project
  223
+[addonsProjectFile]: https://raw.github.com/openframeworks/openFrameworks/master/addons/.project
  224
+
  225
+[01downloadEclipse]: 01downloadEclipse.png
  226
+[01workspaceLauncher]: 01workspaceLauncher.png
  227
+[01importProjects]: 01importProjects.png
  228
+[02importProjects]: 02importProjects.png
  229
+[01externalTool]: 01externalTool.png
  230
+[02externalTool]: 02externalTool.png
  231
+[03externalTool]: 03externalTool.png
  232
+[01createTestProject]: 01createTestProject.png
  233
+[01importTestProject]: 01importTestProject.png
  234
+[02importTestProject]: 02importTestProject.png
  235
+[01setReferences]: 01setReferences.png
  236
+[01debugTarget]: 01debugTarget.png
  237
+[02debugTarget]: 02debugTarget.png
  238
+[03debugTarget]: 03debugTarget.png
  239
+[04debugTarget]: 04debugTarget.png
  240
+[05debugTarget]: 05debugTarget.png
  241
+[06debugTarget]: 06debugTarget.png
  242
+[01addCode]: 01addCode.png
  243
+[02addCode]: 02addCode.png
  244
+[03addCode]: 03addCode.png
  245
+[01debugTestProject]: 01debugTestProject.png
  246
+
  247
+
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.