Using Intel® C++ Compiler with the Eclipse* IDE on Linux*

Content

Introduction

Intel C++ Compilers for Linux can be used together with the Eclipse IDE to create C/C++ applications. Via an Intel C++ Eclipse extension the compiler is integrated using the well-known Eclipse C/C++ Development Tooling (CDT) plug-in. Hence all existing features of CDT, like different views, wizards, a powerful editor, and debugging, can be easily used with the Intel compiler as well. In the following a “How-to” guide is provided which explains configuration and usage.

Requirements

Before starting with the integration, the following must have been installed:

Make sure the Eclipse IDE is working correctly and C/C++ projects can be built using the CDT plug-in. Please be aware that only the listed versions are supported. Any later version of Eclipse or CDT might not work. Consult the Release Notes for the latest status of supported Eclipse, CDT & Java runtime versions.

Note:
In case Eclipse has to be installed first, use the package Eclipse IDE for C/C++ Developers. It already comes with everything needed for C/C++ development. We will use it as reference in the following.

Please refer to the Release Notes for the latest status of supported Eclipse, CDT & Java runtime versions.

Installing the Integration

The following is a brief overview about how to install the Intel C++ Eclipse extension. More information see Learn More below.

Open the Install dialog for plug-ins via menu Help->Install New Software...:

Click on the Add… button and the Add Repository dialog opens:

Click on the Local… button, specify the directory containing the Intel C++ Eclipse extension and confirm.

Note:
The Intel C++ Eclipse extension can be found in the installation directory of Intel Composer XE, subdirectory eclipse_support/cdt8.0/eclipse.

Back in the Install dialog select the item Intel(R) C++ Compiler XE 13.0 for Linux* OS and continue by pressing the button Next >.
Optionally you can also install compiler documentation (recommended) and Intel® Debugger support for native & Intel® MIC architecture (provided they are already installed with Intel Composer XE).

Note:
In case there are no items listed, ensure that Group items by category is not selected.

The next dialog summarizes all plug-ins to install. Continue via button Next >:

Finally, the license files are displayed. Make sure to read them. Accept and start installation by clicking on button Finish:

Eventually you will be faced with a warning about unsigned content. Confirm by clicking on button OK:

After installation is complete, restart Eclipse.

Using Intel C++ Eclipse Extension

Once the Intel C++ Eclipse extension is installed it can be used for all C/C++ projects – new ones as well as existing ones.

When using the extension, make sure to source the compiler scripts before starting Eclipse:

 $ source <composer_xe_path>/bin/compilervars.[sh|csh] [ia32|intel64]
 $ eclipse

This is crucial to locate the compiler installation. See the compiler documentation for more information about the compiler scripts.

Note:
If you experience issues with the integration try to set the locale to en_US when starting Eclipse, e.g.:

 $ LANG=en_US eclipse

Create New Project

To create a new C/C++ project, use the Eclipse/CDT wizard via File->New->C Project or C++ Project:

By default the flag Show project types and toolchains only if they are supported on the platform is selected. Thus, all toolchains are shown for which there is an existing compiler installation. Select the toolchains for your project – multiple can be selected at once. To use the latest compiler from Intel Composer XE 2013, select version v13.0.0. It is also possible to use older versions in addition as long as there are existing compiler installations.
When unchecking the flag Show project types and toolchains only if they are supported on the platform, all toolchains are shown, even if no appropriate compiler is installed on the local system. This can be used for environments with distributed build systems where not all nodes have all compilers installed, but only subsets each. Those toolchains can’t be used unless the proper compiler is installed but they will be present and can be configured.

Once a new project is created like this building, linking, executing and debugging is no different than used from CDT with the default toolchain.

Convert Existing Project

If a C/C++ project already exists and contains configurations based on earlier Intel compiler toolchains or the Linux GCC toolchain it can easily be changed via the Project Update tool. It is accessible via Eclipse menu or the project’s context menu. It’s use is different depending on whether Intel C++ Compiler is used the first time or it should be updated to the latest version.

First Time Use
If no Intel compiler configuration is available yet use Intel Tools->Update Projects->Use Intel C++ Compiler:

Here you can easily select existing configurations whether and how they should be converted or copied to the Intel C++ Compiler. In most cases it might be sufficient to add two new configurations for both debug and release mode for the Intel C++ Compiler. The dialog above shows exactly this example. Only the existing configurations (Debug & Release) are converted to use the Intel C++ Compiler. While doing so the newly created configurations can be (re-)named directly for convenience.
It is also possible to remove the original configurations by unchecking the Keep flags once they got converted. This converts existing configurations to Intel C++ Compiler.

After clicking on button Next > the version of Intel C++ Compiler can be selected:

Select the compiler version which should be used and complete with clicking the button Finish.

Updating Intel C++ Compiler Version
If an Intel compiler configuration is already available use Intel Tools->Update Projects->Update to the Latest Intel C++ Compiler:

Here you can easily select existing configurations whether and how they should be converted to the latest compiler version. In most cases it might be sufficient to add two new configurations for both debug and release mode for the latest compiler. The dialog above shows exactly this example. Only the latest existing configurations (Debug_12.1.0 & Release_12.1.0) are converted to the latest compiler version. While doing so the newly created configurations can be (re-)named directly for convenience.
It is also possible to remove the original configurations by unchecking the Keep flags once they got copied. This updates existing configurations to use the latest Intel C++ Compiler version.

Complete with clicking on button Finish.

Configuration of Intel C++ Compiler

Configuration of the Intel C++ Compiler configurations works the same as for CDT’s default (GCC). It can be accessed via project properties:

Select the build configurations -- multiple can be selected as well* -- to change. In the above example an additional macro (MY_DEBUG_MACRO) was added to the debug build configuration for Intel C++ Compiler XE 13.0 (Debug (v 13.0.0)). Other changes are also possible, like changing the optimization defaults, selecting SIMD extensions, libraries to use, etc. When done with changes, confirm by pressing button OK.

(*): If multiple build configurations are selected, do not mix Intel C++ Compiler and GNU GCC* compiler toolchains as this is not supported! Only select multiple of the same kind.

Learn More

For more information, please see section Using Eclipse* in the Intel® C++ Compiler XE 13.0 User and Reference Guides. Also consult the Release Notes for the latest status of supported Eclipse, CDT & Java runtime versions.

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.