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

Invoke the Compiler

Requirements Before Using the Command Line

You may need to set certain environment variables before using the command line. For more information, see Specify the Location of Compiler Components.

Compiler Drivers

The Intel® oneAPI DPC++/C++ Compiler provides multiple drivers that can be used to invoke the compiler from the command line. Use the driver appropriate for your specific project.

Language Linux Drivers Windows Drivers Option Style Notes

C

icx

icx-cc

icx-cc

Linux-style

icx is the recommended default C driver for Linux.

If you use icx with a C++ source file, it is compiled as a C++ file. Use icx to link C object files.

icx-cc is the Microsoft-compatible variant of icx.

C++

icpx

icpx

Linux-style

icpx is the recommended default C++ driver for Linux.

If you use icpx with a C source file, it is compiled as a C++ file. Use icpx to link C++ object files.

C/C++

icx-cl (see notes)

icx

icx-cl

Windows-style

icx is the recommended default driver for Windows.

icx-cl is the Microsoft-compatible variant of icx.

NOTE:
On Linux, icx-cl is experimental and requires the Microsoft Visual Studio Package.

Use the Compiler from the Command Line

Invoke the compiler on the command line using the following syntax:

{compiler driver} [option] file1 [file2...]

Argument Description

option

Indicates one or more command line options.

On Linux systems, the compiler recognizes one or more letters preceded by a hyphen (-).

On Windows, options are preceded by a hyphen (-) or slash (/). This includes linker options.

Options are not required when invoking the compiler. The default behavior of the compiler implies that some options are ON by default when invoking compiler.

file1, file2...

Indicates one or more files to be processed by the compiler.

For example:

icpx hello-world.cpp

For SYCL compilation, use the -fsycl option with the C++ driver:

icpx -fsycl hello-world.cpp

Linux

When you invoke the compiler on Linux:

  • It compiles and links the input source file(s).

  • It produces one executable file: a.out

  • It places a.out in your current directory.

Windows

When you invoke the compiler on Windows:

  • It compiles and links the input source file(s), producing object file(s) and assigns the names of the respective source file(s), but with an .obj extension.

  • It produces one executable file and assigns it the name of the first input file on the command line, but with an .exe extension.

  • It places all the files in your current directory.

Other Methods for Using the Command Line to Invoke the Compiler

  • Using makefiles from the Command Line: Use makefiles to specify a number of files with various paths and to save this information for multiple compilations. For more information on using makefiles, see Use Makefiles to Compile Your Application.
  • Using a Batch File from the Command Line: Create and use a .bat file to execute the compiler with a desired set of options instead of retyping the command each time you need to recompile.