Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

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

$
0
0

Content

Introduction

Intel® C++ Compilers for Linux* can be used together with the Eclipse* IDE to create C/C++ applications. Via an Eclipse* IDE extension, which is called Intel® C++ Compiler XE plug-in, 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® C++ Compiler as well. In the following a “How-to” guide is provided which explains configuration and usage.
We'll use Intel® Parallel Studio XE 2016 with Eclipse* IDE 4.5 (Mars) in the following. They are the latest versions and recommended; older ones also work, but with a slightly different configuration.

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* IDE, CDT & Java* runtime versions.

Hint:
In case an Eclipse* IDE 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.

Installing the Integration

The following is a brief overview about how to install the Intel® C++ Compiler XE plug-in for Eclipse* IDE. For more information, see Learn More below.

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

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

Click on the Local… button and specify the directory containing the Intel® C++ Compiler XE plug-in for Eclipse* IDE and confirm.
Install Dialog -- Intel(R) C++ Compiler

Note:
The Intel® C++ Compiler XE plug-in for Eclipse* IDE can be found in the installation directory of Intel® Parallel Studio XE 2016, subdirectory ide_support_2016/eclipse/compiler_xe/.
For pre-2016 suites, the location of the plug-in can be found relative to the Intel® Composer XE root, subdirectory eclipse_support/cdt8.0/eclipse/.

Back in the Install dialog select the item Intel® C++ Compiler XE and continue by pressing the button Next >.

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 >:
Install -- Details

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

After installation is complete, restart Eclipse.

Using the Integration

Once the Intel® C++ Compiler XE plug-in for Eclipse* IDE 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 <istall-dir>/compilers_and_libraries/linux/bin/compilervars.[csh|sh] [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->Project..., C/C++, [C|C++] Project:
Create 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 Intel® C++ Compiler compiler, select Intel(R) C++ Compiler XE.
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 Eclipse menu Project->Properties or the project’s context menu Properties:Properties -- Switch Toolchain

To switch to Intel® C++ Compiler compiler, select Intel(R) C++ Compiler XE as Current toolchain. The opposite is also possible: Switch back to any other toolchain seamlessly. Even individual tools can be modified here, which is not recommended, though.

Configuration of Intel® C++ Compiler

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

Select the build configurations -- multiple can be selected as well* -- to change. In the above example IPO (-ipo) was enabled for thedebug build configuration for Intel® C++ Compiler. 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.

It is also possible to select different Intel® C++ Compiler versions via tab Intel® C++ Compiler:
Properties -- Select Intel(R) C++ Compiler Versions

Select the desired Intel® C++ Compiler version from the installed ones on the underlying system. Click button Use Selected to activate it and confirm by pressing button OK. By default, it always uses the latest version.

Learn More

For more information, please see section Using Eclipse* from the compiler documentation. Also consult the Release Notes for the latest status of supported Eclipse* IDE, CDT & Java* runtime versions.


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>