Developing with Eclipse

Download from here You need the C++ Developt Toolkit, CDT.

Extract the archive to the location where you want Eclipse to reside.

Start eclipse with the executable.

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 menubar at top of the screen, "New", and then "Makefile project with existing code"

Import existing code page: Name the Project whatever you want. Uncheck the "use default location" checkbox. Specify the location to your project - For example cloudy/trunk/ Choose MacOSC GCC in the toolchain list. Click Next

Click Advanced Settings

In the C/C++ Build section, uncheck "default build command" and ensure that "generate makefile automatically" is unchecked

Highlight the text in the "Build Directory" textbox and then click workspace.

Browse to the sys_gcc directory and click OK

Click the behavior tab - The things on this tab will automatically be added to the make command. If you check "Use parallel build" and select 4, it will automatically add -j 4 to the make command so there is no need to specify it on the previous tab.The same is true to the Incremental build and the Clean sections of the Behavior tab.

Click OK

Click Finished - It should start building.

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

Return to main wiki page

Last modified 5 months ago Last modified on 2020-05-15T01:26:01Z