Using Eclipse CDT

From OpenCog
Jump to: navigation, search

Install Eclipse

sudo apt-get install eclipse-cdt

or download from Eclipse website.

Install Eclipse Plugins

Help > Install New Software

Terminal (since Eclipse 4.4 Luna)

Allows you to telnet and do bash commands without opening Konsole.

  1. Work with: --All Available Sites--
  2. Search "terminal"
  3. Select:
    1. Local Terminal (Incubation)
    2. TCF Terminal (Console) View
    Terminalcdt.png
  4. Click "Next" ... many click-through dialog boxes...

Now you can create a Terminal view by Window > Show View > Other... (Alt+Shift+Q, Q) and choose Terminal > Terminal.

Terminalview.png

To run local bash, use this setting:

Terminalbash.png

Terminalbash2.png

To connect to OpenCog server shell:

Terminalcog.png

To connect to OpenCog Scheme shell:

Terminalscheme.png

CMake Editor

Enter URL in Work with field

http://cmakeed.sourceforge.net/eclipse/

Name it "CMake Editor", click [Add]

Choose "CMake Editor", click [Next]

... many click-through dialog boxes...

Doesn't seem to work now, at least with Eclipse 4.4 Luna on Ubuntu 14.04 64-bit. --Hendy (talk) 14:58, 12 July 2014 (CDT)

For Fedora: you can install eclipse-cmakeed package until Fedora 20. For later versions, you can manually download and install eclipse-cmakeed-1.1.6-6.fc20.noarch.rpm manually. It works fine at least until Eclipse 4.5.1 in Fedora 22.

CMake Builder

Enter URL in Work with field

http://www.cmakebuilder.com/update 

Name it "CMake Builder", click [Add]

Unselect "Group items by Category"

Choose "CMake Builder core plugin", click [Next]

... many click-through dialog boxes...

Prepare Dependencies

See Building OpenCog.

Generate new build files

(assuming source code working trees from GitHub are in a folder called cogutil, atomspace, and opencog)

Execute from outside of the source code folder:

mkdir cogutil/build
cd cogutil/build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..
make -j4
cd ../..

mkdir atomspace/build
cd atomspace/build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..
make -j4
cd ../..

mkdir opencog/build
cd opencog/build
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..
make -j4
cd ../..

Import Project

File > Import > General > Existing Projects into Workspace > [Next] > {browse to opencog_build folder} > [Finish]

Leave "Copy projects into workspace" unchecked.

Fix: Symbol 'shared_ptr' could not be resolved

C++11 with Eclipse - 01 discovery.png

C++11 with Eclipse - 02 index.png

C++11 with Eclipse - 03 project properties.png

C++11 with Eclipse - 04 rebuild.png

References:

Import/Setup Code Formatter

Open preferences window: Window > Preferences Open C/C++ > Code Style > Formatter in preferences window. You can either create a new code format for opencog using New button according to development standards, or import this predefined code style using the Import button.

You can either select this style to be used by all projects, or using on OpenCog projects only by selecting this style for each project. To do this, select a project (e.g. atomspace), go to Project > Properties, open C/C++ General > Formatter, enable "Enable project specific settings" and select OpenCogStyle (or the name of the style you've created).

Build

Project > Build All

Notes

Works well with Ubuntu 12.04, Eclipse 3.7.2 and OpenJDK 6b24.

Also works with Ubuntu 14.04 64-bit, Eclipse 4.4 Luna, and Oracle Java 8. --Hendy (talk) 15:10, 12 July 2014 (CDT)

Known to have memory/GC problems with Ubuntu 12.10, Eclipse 3.8.0 and Oracle/Sun JDK 7.