Compiling from the command line with Borland C++

PREVIOUS NOTE: This text is based upon the free distribution of the Borland C++ 5.5 Command Line tools, but it is applicable to most C++ compilers made by Borland with just some small variations.

Borland compilers support the possibility to compile our projects directly from the command line.

For that it is recommendable that we make certain preparative operations that will ease the compiling process. First we must locate the directory where our compiler has been installed, that from now on we will call base directory. From this directory they usually hang subdirectories BIN, INCLUDE and LIB. In the Borland C++ 5.5 Command Line Tools the directory by default is:


Once located, we will go to the subdirectory called BIN that hangs from this base directory. In the BIN subdirectory is the main application that is in charge of compiling programs from the command line; in case that it is a 32bits Borland C++ compiler this one will be called BCC32.exe; otherwise in previous versions it could be called BCC.exe (Borland C++) or TCC.exe (Turbo C++).

If our compiler is BCC32.EXE we have to generate a file called BCC32.CFG in the case that it does not exists yet (If we are using an old version of Turbo C++ this file has to be called TURBOC.CFG). In order to edit te file you may use either Windows Notepad, MSDOS Edit or your favorite editor. You must make that the file include the following lines (copy all characters, even the initial -, and do not add spaces):

replacing C:\BORLAND\BCC55 by your base directory if it is different. Optionally, in this file we may include other options that we always want to be included when compiling a program.

Without leaving BIN directory we will create the file ILINK32.CFG (if our compiler is not a 32 bits one, we must create the file TLINK.CFG) with the following content:

replacing C:\BORLAND\BCC55 by your base directory if it is different. In this file we can include any other linker options.

Finally we only have to include the complete path of the BIN directory that hangs from our base directory (C:\BORLAND\BCC55\BIN) in the system environment variable called PATH. For that:


Once finished the previous process we will be ready to use our borland compiler for compiling programs from the command line. To do so we have to use the executable BCC32.EXE located at BIN subdirectory, that should already be in the PATH. If you want to detailed know its options type the name of the program without parameters (BCC32.EXE). In order to compile a program you shall write the compiler name (BCC32) followed by the names of the sourcecode files you want to compile. For example, to compile the file test.cpp we would write:
bcc32 test.cpp
in the command line.

Borland and Borland C++ Compiler are trademarks of Inprise Corporation

©The C++ Resources Network, 2000 - All rights reserved
Return back