|
|
## Getting started
|
|
|
|
|
|
Download from [here](https://www.eclipse.org/downloads/).
|
|
|
These notes are accurate for Eclipse IDE 2020‑12 on my Mac and Ubuntu.
|
|
|
FWIW, I make an annual donation to the Eclipse Foundation.
|
|
|
|
|
|
The installer will prompt for what to install. You need the Eclipse IDE for C++ Developers, usually called the `CDT`.
|
|
|
|
|
|
-----
|
|
|
|
|
|
### MacOS
|
|
|
|
|
|
I accepted the default locations for the Java VM and Eclipse. It worked.
|
|
|
|
|
|
### Ubuntu
|
|
|
|
|
|
Installation was not without drama.
|
|
|
|
|
|
The recommendation is to `sudo` install.
|
|
|
The app proposes `/root/` which I accepted. That folder is only accessible
|
|
|
if you are actually root. I did so, with `sudo su`, and removed the eclipse installed there.
|
|
|
|
|
|
I tried again as myself and installed into a folder beneath `~gary`. That seemed
|
|
|
to work but eclipse could not access some of the hidden files and folders beneath
|
|
|
the Cloudy `origin / master`. I did eventually get it all to work by setting
|
|
|
permissions by hand.
|
|
|
|
|
|
*Perhaps* the installation would have been drama-free had I installed as `sudo` but changed
|
|
|
the installation folder to space under `~gary`.
|
|
|
The second install works so I stopped installing.
|
|
|
|
|
|
### both
|
|
|
|
|
|
Launch eclipse when it offers to. I accepted the default workspace location.
|
|
|
|
|
|
Choose a folder to be your workspace. "eclipe/workspace/" is good.
|
|
|
|
|
|
Choose the workbench circle on the right - This should take you to a standard-looking IDE interface
|
|
|
|
|
|
----------
|
|
|
|
|
|
## Adding Cloudy as a Project
|
|
|
|
|
|
Click "File" in the menu bar at top of the screen, "New", and then "Makefile project with existing code"
|
|
|
|
|
|
**Import existing code page** Name the Project whatever you want.
|
|
|
*Existing code location* select the source folder.
|
|
|
Choose C++ as the *language*.
|
|
|
Choose MacOSX GCC in the *Toolchain for indexer Settings* list.
|
|
|
|
|
|
Click finish
|
|
|
|
|
|
## Properties for Cloudy project
|
|
|
|
|
|
Right click on the project browser in the left column and select
|
|
|
*properties* from the menu. It is at the bottom.
|
|
|
|
|
|
### C/C++ Build section - Builder Settings
|
|
|
|
|
|
Uncheck **Use default build command**
|
|
|
|
|
|
**Generate Makefiles automatically** Make sure this is unchecked
|
|
|
|
|
|
**Build Directory:** textbox and then click workspace.
|
|
|
|
|
|
Browse to the sys_gcc directory and click OK
|
|
|
|
|
|
### C/C++ Build section - Behavior
|
|
|
|
|
|
**Enable parallel build** and accept default **Use optimal jobs**
|
|
|
|
|
|
Click **Apply and finish**
|
|
|
|
|
|
## Tips for working with Eclipse
|
|
|
|
|
|
|
|
|
#### Keyboard Shortcuts
|
|
|
|
|
|
Keyboard shortcuts can be viewed and changed in the preferences
|
|
|
|
|
|
Click "Window" at the top of the page (next to "Help")
|
|
|
|
|
|
Click "Prefences" from the drop-down menu
|
|
|
|
|
|
Expand the "General" section
|
|
|
|
|
|
Click on "Keys"
|
|
|
|
|
|
In the "Keys" window, there is a textbox below "Scheme"
|
|
|
|
|
|
Type keywords into this box to filter the list of keyboard shortcuts. For example, typing "bracket" into the text box shows that the command for "Go to Matching Bracket" is shift+ctrl+P.
|
|
|
|
|
|
|
|
|
#### The local resource is out of sync error
|
|
|
|
|
|
In its default state eclipse cannot deal with files that change outside of its control.
|
|
|
To fix this go to Preferences->general->workspace and enable refresh automatically.
|
|
|
|
|
|
Also select save automatically before build
|
|
|
|
|
|
|
|
|
### Working with breakpoints
|
|
|
|
|
|
Set a breakpoint by right clicking in the margin to the left of the source.
|
|
|
Start running the code by clicking on bug icon to the right of the hammer build icon.
|
|
|
The code will immediately stop in main and you will be in the debug perspective.
|
|
|
To continue debugging click on the right arrow in the debug window,
|
|
|
to the left of the red square (the stop debugging icon).
|
|
|
|
|
|
|
|
|
### Creating a debug configuration
|
|
|
|
|
|
The default configuration will create an optimized build, which may not be useful for debugging.
|
|
|
To create a debug build, with no optimization, we need to create a debug configuration and
|
|
|
add the *debug* option to the makefile.
|
|
|
|
|
|
*To create a debug configuration* right click on the project name in the project explorer,
|
|
|
the window on the left side of the IDE.
|
|
|
Select properties / C/C++ build.
|
|
|
You add a debug configuration with the "manage configurations" button.
|
|
|
|
|
|
Select the debug configuration then the behavior option.
|
|
|
Here I add "use parallel build" and set the number of threads,
|
|
|
add "debug" to the "Build (incremental build) option,
|
|
|
and "distclean" to the "clean" option.
|
|
|
|
|
|
The "builder settings" should show a build command something like "make debug -j4".
|
|
|
Select apply / ok and the project will build.
|
|
|
|
|
|
|
|
|
### Changing configurations
|
|
|
|
|
|
Right click on the project name in the project explorer window.
|
|
|
The "build configuration" allows the configuration to be changed.
|
|
|
|
|
|
|
|
|
#### Eclipse indexer confusion when building in one of the sys_??? directories
|
|
|
|
|
|
The Eclipse indexer, which derives information about variables and routines from header file information,
|
|
|
may become confused.
|
|
|
The symptom is that the source editor will claim that a larger number of syntax errors are present,
|
|
|
but the code will build properly.
|
|
|
This is caused by Eclipse looking for the header files in the sys_??? directory rather than the source directory.
|
|
|
To fix, go to Properties -> C/C++ General -> Paths and Symbols -> Includes -> Library Paths and "Libraries.
|
|
|
Add the source directory.
|
|
|
The settings are applicable to the selected project only.
|
|
|
|
|
|
-------
|
|
|
|
|
|
Return to [DeveloperPages](DeveloperPages) or go [home](home)
|
|
|
|