Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Compilation Overview

Compilation Environment

You can customize the environment used during compilation using a combination of

You can also modify the compilation by adding additional include directories for the compiler to search during compilation. See Specify Compiler Files for more information.

Default Compiler Behavior

The Intel® oneAPI DPC++/C++ Compiler processes C/C++ and SYCL source files. Compilation can be divided into these major phases: :

  • Preprocessing
  • Semantic parsing
  • Optimization
  • Code generation
  • Linking

By default, the compiler performs the first four phases of compilation and then invokes the linker to perform the linking phase. The default linkers are ld for Linux and link for Windows.

Default settings for the compiler include:

  • Optimization level O2 (-O2)
  • Floating point model = fast (-fp-model=fast)
  • C language standard: C17
  • C++ language standard: C++17
  • C++ runtime:
    • Linux: libstdc++, using headers and libraries installed on the system
    • Windows: Microsoft Visual C++ (MSVC) provided headers and libraries
  • SVML and specific interfaces enabled to call into the Intel libirc library

Customize the Compilation Process

The Intel® oneAPI DPC++/C++ Compiler provides multiple options to customize compilation.

Preprocessing

Several options are available to customize preprocessing. For example, you can:

  • Specify the location of system and user header files
  • Specify macros
  • Stop the compilation process after preprocessing
  • Send preprocessed output to stdout

You can optionally use your own preprocessor to generate a preprocessed file which can then be passed to the compiler.

For a detailed list of preprocessing options, see Preprocessor Options.

Compiling

Compiler options are not required to compile your program, but can be used to control different aspects of your application, such as:

  • Code generation
  • Optimization
  • Output file (type, name, location)
  • Linking properties
  • Size of the executable
  • Speed of the executable

For a detailed list of all compiler options, see Compiler Options.

Linking

You can perform the linking phase using the Intel compiler to invoke the linker (default) or by calling the linker directly.

NOTE:
On Linux, calling the linker directly requires explicit understanding of which specific system and Intel libraries need to be linked in, as they will need to be passed directly to the linker.

To prevent default linking at compilation time, use the -c option. You must then explicitly pass along the generated object on the compilation command line and the compiler will create the final binary.

You can pass options to the linker for additional control of the linking phase. See Pass Options to the Linker for additional information.