Intel® C++ Compiler 16.0 User and Reference Guide

Invoking the Intel® Compiler

Requirements Before Using the Command Line

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

Using the Intel® C++ Compiler from the Command Line

You can invoke the compiler using the icc or icpc command.

Note

You can also use the compiler from within the IDE.

For more information on using Visual Studio*, see Using Microsoft Visual Studio*. For information on using Xcode*, see Using Xcode*. For information on using Eclipse*, see to Using Eclipse*

Linux OS*:

Invoke the compiler using either icc to compile C source files or icpc to compile C++ source files.

  • When you invoke the compiler with icc, the compiler builds C source files using C libraries and C include files. If you use icc with a C++ source file, it is compiled as a C++ file. Use icc to link C object files.

  • When you invoke the compiler with icpc the compiler builds C++ source files using C++ libraries and C++ include files. If you use icpc with a C source file, it is compiled as a C++ file. Use icpc to link C++ object files.

The icc or icpc command does the following:

  • Compiles and links the input source file(s).

  • Produces one executable file, a.out, in the current directory.

OS X*:

Invoke the EDG compiler using icc/icpc and invoke the CLANG compiler using icl/icl++ to compile C/C++ source files.

  • When you invoke the compiler with icc, the compiler builds C source files using C libraries and C include files. If you use icc with a C++ source file, it is compiled as a C++ file. Use icc to link C object files.

  • When you invoke the compiler with icpc the compiler builds C++ source files using C++ libraries and C++ include files (libc++ library is used by default). If you use icpc with a C source file, it is compiled as a C++ file. Use icpc to link C++ object files.

  • When you invoke the compiler with icl, the compiler builds C++ source files using clang C libraries and C include files. If you use icl with a C++ source file, it is compiled as a C++ file. Use icl to link C object files.

  • When you invoke the compiler with icl++ the compiler builds C++ source files using C++ libraries and C++ include files (libc++ library is used by default). If you use this command with a C source file, the source file is compiled as a C++ file. Use icl++ to link C++ object files.

The icc/icpc or the icl/icl++ command does the following:

  • Compiles and links the input source file(s).

  • Produces one executable file, a.out, in the current directory.

Windows*:

You can invoke the Intel® C++ Compiler on the command line using the icl command. This command:

  • Compiles and links the input source file(s).

  • Produces object file(s) and assigns the names of the respective source file(s), but with a .obj extension.

  • Produces one executable file and assigns to it the name of the first input file on the command line, but with a .exe extension.

  • Places all the files in the current directory.

Because the driver calls other software components, error messages may be returned by these other components. For instance, the linker may return a message if it cannot resolve a global reference. The watch option can help clarify which component is generating the error.

Command-line Syntax

When you invoke the Intel® C++ Compiler, the syntax is:

// (Linux*)
{icc|icpc} [options] file1 [file2 . . .]
// (OS X*)
{icc|icpc} [options] file1 [file2 . . .]
// (OS X*)
{icl|icl++} [options] file1 [file2 . . .]
// (Windows*)
icl [options] file1 [file2 . . .][/link link_options]

Argument

Description

options

Indicates one or more command-line options. On Linux* and OS X* systems, the compiler recognizes one or more letters preceded by a hyphen (-). On Windows*, options are preceded by a 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.

Note

The compiler recognizes Language Extensions for Offloading in the source program by default and builds a heterogeneous binary that runs on both the target and host when any are present. If your program includes these language extensions and you do not want to build a heterogeneous binary, specify the negative form of the [Q]offload compiler option. For more information, see Programming for Intel® MIC Architecture: Heterogeneous Programming and the [Q]offload compiler option.

file1, file2 . . .

Indicates one or more files to be processed by the compiler. You can specify more than one file, using space as a delimiter for multiple files.

/link (Windows*)

All options following /link are passed to the linker. Compiler options must precede link if they are not to be passed to the linker.

Other Methods for using the Command Line Window to Invoke the Compiler

See Also