GCC* Compatibility and Interoperability

This topic applies to Linux*. This content is specific to C++; it does not apply to DPC++.

The Intel® oneAPI DPC++/C++ Compiler is compatible with most versions of the GNU* Compiler Collection (GCC*). The release notes contains a list of compatible versions.

C language object files created with the compiler are binary compatible with the GCC and C/C++ language library. You can use the Intel® oneAPI DPC++/C++ Compiler or the GCC compiler to pass object files to the linker.

Note

When using an Intel software development product that includes an Intel® oneAPI DPC++/C++ Compiler with a Clang front-end, you can also use icx or icpx.

The Intel® oneAPI DPC++/C++ Compiler supports many of the language extensions provided by the GNU compilers. See http://www.gnu.org for more information.

Note

Statement expressions are supported, except that the following are prohibited inside them: Branching out of a statement expression and statement expressions in constructor initializers are not allowed. Variable-length arrays are no longer allowed in statement expressions.

Note

The Intel® oneAPI DPC++/C++ Compiler supports GCC-style inline ASM if the assembler code uses AT&T* System V/386 syntax.

GCC Interoperability

C++ compilers are interoperable if they can link object files and libraries generated by one compiler with object files and libraries generated by the second compiler, and the resulting executable runs successfully. The Intel® oneAPI DPC++/C++ Compiler is highly compatible with the GNU compilers.

The Intel® oneAPI DPC++/C++ Compiler and GCC support the following predefined macros:

You can specify the -no-gcc option to undefine these macros. If you need GCC interoperability (-cxxlib), do not use the -no-gcc compiler option.

CAUTION

Not defining these macros results in different paths through system header files. These alternate paths may be poorly tested or otherwise incompatible.

How the Compiler Uses GCC

The Intel® oneAPI DPC++/C++ Compiler uses the GNU tools on the system, such as the GNU header files, including stdio.h, and the GNU linker and libraries. So the compiler has to be compatible with the version of GCC or G++* you have on your system.

By default, the compiler determines which version of GCC or G++ you have installed from the PATH environment variable.

If you want use a version of GCC or G++ other than the default version on your system, you need to use either the -gcc-name or -gxx-name compiler option to specify the path to the version of GCC or G++ that you want to use. For example:

The Intel® oneAPI DPC++/C++ Compiler driver uses the default version of GCC/G++, or the version you specify, to extract the location of the headers and libraries. The cxxlib options are connected to linking in the GNU C++ library. These options are not directly related to -gcc-name or -gxx-name.

Compatibility with Open Source Tools

The Intel® oneAPI DPC++/C++ Compiler includes improved support for the following open source tools: