Show: Delphi C++
Display Preferences

Command-Line Interfaces of Clang-enhanced C++ Compilers

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Interfaces of C++ Compilers

Command-line interfaces for Clang-enhanced C++ compilers are very similar one to another. This topic provides information that applies to all of them.

Command-Line Options of Clang-enhanced C++ Compilers

Note: Using Clang-enhanced C++ compilers on the command line can have unexpected results. However, the options of Clang-enhanced C++ compilers that are available in the IDE have been tested during implementation. For more information, see:

Clang-enhanced compilers are very similar to one another, and they share most of their command-line options. A subset of the features of Clang have been integrated into RAD Studio, and some of these are available on the Project Options dialog box.

Executing at the Command Line

For anyone who calls Clang-enhanced C++ compilers at the command line, we recommend going through the driver, as follows:

<compiler> -c test.cpp


<compiler> -tWCV myApplication.cpp

In this case, Clang-enhanced C++ compilers run with the following command-line parameters enabled by default:

If you are an experienced user of Clang and you want to use the Clang-enhanced C++ compilers without going through the driver, you should pass -cc1 as the first option, telling the compiler that you are taking matters in your hands and want to have total/strict control on all options. In this case, no option is automatically injected for you, and you would need to specify the command-line parameters above manually.

Error Reporting Options

Switch Description
--warn-common Warn about duplicate common symbols.
--warn-unresolved-symbols Report unresolved symbols as warnings.
--error-unresolved-symbols Report unresolved symbols as errors.

#include Paths and Lookup

Clang-enhanced C++ compilers support three different header/source paths:

  • -isystem is for system headers included with the compiler. Warnings for headers found on this path are suppressed.
  • -I is for headers provided by third parties.
  • -idirafter is for paths searched after paths specified via -I or -isystem have been searched. If the path has a leading '=' character, this character is replaced with the value specified via -sysroot.
  • -iquote is for your own source files and headers. As the name suggests, this path is used only for directives with quotes: #include "file". If the named file is not found, then the paths specified by -I and -isystem are searched, as if the directive was #include <file>.

For more information, see #include.

Linking with the Delphi Run-Time System

By default, if you do not specify a target using the -t command-line switch, Clang-enhanced C++ compilers link with the Delphi run-time system. For example, using BCCAARM.EXE:

Command Description

bccaarm file.cpp

BCCAARM builds your application as a console application that links with the Delphi run-time system.

bccaarm -tC file.cpp

BCCAARM builds your application as a console application that does not link with the Delphi run-time system.

bccaarm -tF file.cpp

BCCAARM builds your application as a FireMonkey application.

Using Parallel Compilation

To enable parallel compilation on the command line, use the --jobs=<N> command-line option.

To specify the number of subprocesses to use, append a number to the command-line option. For example, to use 2 subprocesses, use --jobs=2. You should not choose a number of subprocesses higher than the number of cores of your processor.

To use as many subprocesses as possible, use --jobs=0.

Parallel compilation is not compatible with the following command-line options:

Displaying the Compiler Help

Execute the command-line interface executable of the target compiler with the --help switch to display the command-line interface help. For example:

bcc64 --help

Use the -cc1 and --help switches to display the switches that you can pass to the compiler using the command-line interface. For example:

bcc64 -cc1 --help
Note: These are the switches that you can use in "Additional options to pass to the compiler", in Project > Options > C++ Compiler > Advanced under Other Options.

Generating Dependency Information

By default, the command-line interface of Clang-enhanced C++ compilers uses the -sys-header-deps command-line option to generate full dependency information, including the system header files.


See Also

Personal tools
In other languages
Previous Versions