Show: Delphi C++
Display Preferences

BCC32.EXE, the C++ 32-bit Command-Line Compiler

From RAD Studio
Jump to: navigation, search

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

BCC32.EXE is the command-line interface of BCC32, the C++ compiler for 32-bit Windows.

Command-Line Syntax

bcc32 [<option>] <filename> [<filename>...]

Use spaces to separate the command-line compiler name, each option, and the filenames. Precede each option by either a hyphen (-) or a forward slash (/). For example:

BCC32 -Ic:\code\hfiles

You can also specify options in configuration (.CFG) files, which are described in Using Compiler Configuration Files (.CFG).

You can use BCC32 to send .OBJ files to ILINK32 or .ASM files to TASM32 (if you have TASM32 installed on your machine).

Displaying Command-Line Help for Detailed Information

To display the BCC32.exe command-line help in the cmd window, include the -h command-line option.

For example, to display a list of the commonly used compiler command-line options, type:

BCC32 -h

In the displayed list, * indicates the options that are enabled by default.

Displaying Help for Specific Options, Groups such as -Axxx and -Vxxx

You can get more specific information about each of the multiletter options, such as -Axxx (language compatibility and standards compliance) and -Vxxx (backward compatibility).

To do this, use the -h command-line option with the initial letter of the option group (such as -A, to specify the -Axxx options). BCC32 will display only the help topics for the specified set of options (such as -Axxx, -Vxxx, or -Wxxx).

For example, to display a description of the -Axxx (language compatibility and standards compliance) options, use the -h and -A command-line options:

C:\>bcc32 -h -A

Default Settings

BCC32.EXE has specific options that are on by default. To turn off a default option or to override options in a configuration file, follow the option with a minus (-) sign.

Files with the .CPP extension compile as C++ files. Files with a .C extension, with no extension, or with extensions other than .CPP, .OBJ, .LIB, or .ASM compile as C files.

The compiler tries to link with a module-definition file with the same name as the executable and the .DEF extension.

General Compiler Output Options

Option Description Details


Compiles to .OBJ, no link.

Compiles and assembles the named .C, .CPP, and .ASM files, but does not execute a link on the resulting .OBJ files.

-e <filename>

Specify executable filename.

Link file using <filename> as the name of the executable file. If you do not specify an executable name with this option, the linker creates an executable file based on the name of the first source file or object file listed in the command.

-l <x>

Pass option to linker.

Use this command-line option to pass <x> options to the linker from a compile command. Use the -l-x command-line option to disable a specific linker option.


Create a MAP file.

Use this compiler option to instruct the linker to create a map file. See Detailed-Segments Map File.

-o <filename>

Compile .OBJ to <filename>.

Compiles the specified source file to <filename>.OBJ.


C++ compile

Causes the compiler to compile all source files as C++ files, regardless of their extension. Use -P- to compile all .CPP files as C++ source files and all other files as C source files. The -P command-line option causes the compiler to compile all source files as C++ files. This option is provided because some programmers use different extensions as their default extension for C++ code.


Generate a multithreaded target.

Creates a multithreaded .EXE or .DLL. This option is not needed if you include a module definition file (.DEF file) in your compile and link commands, which specify the type of 32-bit application you intend to build.


Target uses the Dynamic RTL.

Creates an application that uses the Dynamic RTL.


Target uses the VCL GUI framework.


Target is a shared library.


Generates a package.

Note: Do not use the -t option from the IDE.

Compiler Option Precedence Rules

The command-line compilers evaluate options from left to right, and follow these rules:

  • If you duplicate any option (except for the -D, -I, -L, or -U options), the last option typed overrides any earlier one.
  • Options typed at the command line override configuration and response file options, except for the -D, -I, -L, and -U options, which are cumulative.

Specifying Directories in Command Line Options

The C++ compiler can search multiple directories for include and library files. The syntax for the library directories option (-L) and the include directories option (-I) (like the #define option (-D)) allows multiple listings of a given option. Here is the syntax for these options:

-L <dirname> [<dirname>;...]
-I <dirname> [<dirname>;...]

The <dirname> parameter used with -L and -I can be any directory or directory path. You can enter these multiple directories on the command line in the following ways:

  • You can stack multiple entries with a single -L or -I option by using a semicolon:
BCC32.EXE -L dirname1;dirname2;dirname3 -I include1;include2;include3 myfile.c
  • You can place more than one of each options on the command line, like this:
BCC32.EXE -L dirname1 -L dirname2 -L dirname3 -I include1 -I include2 -I include3 myfile.c
  • You can mix styles:
BCC32.EXE -L dirname1;dirname2 -Ldirname3 -I include1;include2 -I include3 myfile.c

If you list multiple -L or -I options on the command line, the result is cumulative. The compiler searches all the directories listed, in order from left to right.

Using Compiler Configuration Files (.CFG)

If you repeatedly use a certain set of options, you can list them in a configuration file instead of continually typing them on the command line. A configuration file is a standard ASCII text file that contains one or more command-line options. Each option must be separated by a space or a new line.

Whenever you issue a compile command, BCC32.EXE searches for a configuration file called BCC32.CFG. The compiler first looks for the .CFG file in the directory where you issue the compile command, then in the directory where the compiler is located.

You can create and use multiple configuration files in addition to using the default .CFG file.

To use a configuration file, use the following syntax where you would place the compiler options:


For example, you could use the following command line to use a configuration file called MYCONFIG.CFG:


Options typed on the command line override settings stored in configuration files except for the -D, -I, -L, and -U prepended options.

Using Response Files

Response files let you list both compiler options and file names in a single file (unlike configuration files, which accept only compiler options). A response file is a standard ASCII text file that contains one or more command-line options, file names, or both, with each entry in the file separated by a space or a new line. In addition to simplifying your compile commands, response files let you issue a longer command line than most operating systems allow.

The syntax for using a single response file is:

BCC32 @[path]respfile.txt

The syntax for using multiple response files is:

BCC32 @[path]respfile.txt @[path]otheresp.txt

Response files typically have an .RSP extension.

Options typed at the command line override any option or file name in a response file, except for -D, -I, -L, and -U, which are prepended.


See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions