RudeServer Professional C++ CGI Development Libraries
CGI Parser Logo

How-To: Install and Configure Borland® Free Command Line Tools

by Matthew Flood
Last updated December 08, 2006


Introduction  


Using Borland® C++Builder™ Command Line Tools is a great way to start programming C and C++ applications. Unfortunately, configuring the tools so they work properly can be tiresome for newcomers. This How-To will take you step-by-step from downloading the tools to creating your first Hello World executable. Borland provides a readme.txt file in the distribution, and some more detailed information at their website that is intended to help you set up the installation. But since it is such a pain to find, and because they seem to keep renaming everything, I like to provide my version here.

Installing, configuring and testing the tools takes 5 steps (each of these links goes to the appropriate section on this page).

  1. Download the tools from Borland's website
  2. Run the setup program
  3. Add the bin directory to the system PATH
  4. Set up some configuration files.
  5. Test the install

Notes/Corrections: The links in this How-To were last verified on December 8, 2006. If the links are not valid, or you have corrections or advice for improvements, please contact me.

 

Step 1
Download the tools from Borland's website


Download the Borland® Compiler from the download page of borland.com . Just plop the file (freecommandLinetools.exe) on your desktop. This is the installation program. You can delete it after you have run the installation.

NOTE: Before you can download the tools, you will have to create an account with Borland® (or log into an existing account). After accepting the license agreement, you will have the option of downloading the file using FTP or HTTP. If you use HTTP, Borland will make you download a downloader to actually get the file. I would recommend using FTP if the option is available.

 

Step 2
Run the setup program

Run the setup program. Just click the file (freecommandLinetools.exe) downloaded in step 1 and accept all the defaults.
( More explicitly, choose: Next, then Finish, then Yes )
By default, it should install everything to C:\Borland\BCC55 (The rest of this How-To assumes this location).

FYI: For the uninitiated, you should know that bcc32.exe is the main program used from the command line to compile and build programs. Lots of other files are installed: the standard C and C++ header files, object libraries containing the standard library routines, some help files, lots of example programs that most of us will never even peruse, and a few helper programs like the linker (ilink32.exe) and the library manager (tlib.exe) and some oldies but goodies like grep, make and touch.

 

Step 3
Add the /bin directory to the system PATH


Why?

Which would you rather type to invoke the tools?

>C:\Borland\BCC55\bin\bcc32

OR

>bcc32

After the setup program is run (step 2), a whole bunch of executable programs are placed in a new directory : C:\Borland\BCC55\Bin. This step makes it possible for the Operating System (Windows) to find these new executables by name. If you don't do this, then you will need to specify the full path to bcc32 everytime you use it.

To do this on Windows 98

Add the path to the C:\Autoexec.bat file.
Place the following line by itself at the end of the file:

PATH=C:\BORLAND\BCC55\BIN;%PATH%

To do this on Windows NT

Windows NT is very similar to Windows XP. See Christopher Moeller's Supplementary Information page if you need step by step instructions.

To do this on Windows XP

Bring up the Environmental Variables dialog (figures 3-1 and 3-2):

  • Right Click "My Computer" ( Depending on how your system is set-up, "My Computer" is either on your Desktop or in your Start Menu )
  • Select "Properties"
  • Activate the "Advanced" Tab
  • Click the "Environmental Variables" Button

Append ";C:\Borland\BCC44\bin" to the PATH variable (figure 3-2)

  • Select the PATH variable under User Variables
    Note: The PATH variable may appear under both System Variables and User Variables. This How-To changes the User Variable.
  • Click the EDIT button below the list
  • In the "Edit User Variable" box that pops up, move the cursor to the end of the Variable Value field
  • Add a semi-colon ";" to the end of the current value
    Note: If the value is empty, then you do not need to add a semi-colon
  • Add the path "C:\Borland\BCC55\bin" after the semi-colon
  • "OK" your way out of the dialogs

WARNING: If other paths are already present - don't remove them. Each path listed is separated from others by a semi-colon. Each path is the location of executables that are not in the standard locations and if you remove them some other applications in your system may break

 

Figure 3-1: System Properties

figure 3-1

Figure 3-2: Environmental Variables

figure 3-2

 

Step 4 Set up some configuration files


Next, you should create a configuration file for the bcc32 program that tells it where to find its libraries and include files.

  • The file should be named bcc32.cfg
  • It should be placed in the same bin directory where bcc32.exe is located
    (C:\Borland\BCC55\Bin)
  • The contents of the file are the command line options for bcc32 stating the location of include files and libraries:
    -I"C:\Borland\BCC55\Include"
    -L"C:\Borland\BCC55\Lib"
  • Figure 4-1 is provided as a visual aid

Figure 4-1: bcc32.cfg in a text editor

figure 4-1
( bcc32.cfg in a text editor )

STUCK?

If you are having problems with this step, it can also be performed from the command line:

  1. Open a command prompt (see Step 5 for instructions on how to do this)
  2. Type (or cut-n-paste) the following exactly as it appears, including all quotes, and then press enter:
    echo -I"C:\Borland\BCC55\Include" >> C:\Borland\BCC55\Bin\bcc32.cfg
  3. Type (or cut-n-paste) the following exactly as it appears, including all quotes, and then press enter:
    echo -L"C:\Borland\BCC55\Lib" >> C:\Borland\BCC55\Bin\bcc32.cfg
  4. That's it! Step completed!

NOTES:

  • The alternative to performing this step is to provide this information on the command line every time you run bcc32.
  • Christopher Moeller's Supplementary Information page, with details about the install, says that you should also create a similar config file for ilink32 called, surpisingly enough, ilink32.cfg. This is probably a good idea to complete the installation. Personally, I have never invoked ilink32 directly ( bcc32 calls it on my behalf), and my installation runs fine without that config file When creating ilink32.cfg, you will only need to include the -L line, since the -I flag is only for the preprocessor:

Optionally Create ilink32.cfg:

  1. Open a command prompt (see Step 5 for instructions on how to do this)
  2. Type (or cut-n-paste) the following exactly as it appears, including all quotes, and then press enter:
    echo -L"C:\Borland\BCC55\Lib" >> C:\Borland\BCC55\Bin\ilink32.cfg

Step 5 Test the Installation


Why?

If you can perform the following tests, then you know that your environment is set-up correctly. That way, when your program won't compile a week from now, you know that the installation is not the issue.

Open a command prompt:

FYI: IF you are going to be using Borland's Command Line tools, you need to be able to open a command shell in your sleep. Luckily, it is only 2 steps and comes standard on all Windows Versions.

1. Start->Run... (figure 5-1)

Figure 5-1: Selecting Run

figure 5-1


2. Type cmd in the box (figure 5-2)

Figure 5-2: Typing cmd

figure 5-2

Hit OK - the Black Box that appears is the Command Prompt or Command Line

Now you should be able to run bcc32 from the command prompt:

Figure 5-3: Typing bcc32

figure 5-3

3. Let's create a "Hello World" application to test everything....

From the command line, make a folder on your Desktop called mytest and move into it (figure 5-4)

>cd Desktop
>mkdir mytest
>cd mytest

Figure 5-4: Creating mytest directory

figure 5-4

Type edit test.cpp (figure 5-5)
Note: nobody expects you to use edit.exe to create your C and C++ programs. Most of the time, you will use a text editor like notepad.exe, wordpad.exe or my personaly favorite, Winvi.exe. However, since we are at the command line anyway, it is actually less of a hassle to create the 6 line program using edit.exe than it would be to load up your GUI text editor, navigate to the folder, etc.....

Figure 5-5: typing edit test.cpp

figure 5-5

A strange world will open up to you, into which you should type this code (see figure 3-7):

#include <iostream>
int main(void)
{
std::cout << "Hello World\n";
return 0;
}

Figure 5-6: Creating Hello World  program

figure 5-6

To Exit this strange blue world, USE YOUR MOUSE to go to the file menu - save first! then exit!

Figure 5-7: Save and exit  Hello World

figure 5-7

Once you are at the command line again, compile and link you application using bcc32:

>bcc32 test.cpp

Figure 5-8: Compile and Link test.cpp

figure 5-8

The results should look like this:

Figure 5-9: Output from bcc32

figure 5-9

If they did, then YAY! You are done. Happy Coding.

You can run the program you just created by typing the name of it: test

Figure 5-10: Running test program

figure 5-10

FYI: If you examine the directory where you just built your test program, you will see 4 files. test.obj and test.tds are intermediary files, and can be deleted. IF you click on test.exe, a black window will pop up and disappear right away. The window automatically closes when the application exits and is normal. Usually, you will want to open up a command prompt and run your programs from within instead of clicking on them.

Figure 5-11: the mytest directory contents

figure 5-11


"Borland" and "C++Builder" are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries. This How-To is independent of Borland Software Corporation and has not been authorized, sponsored, or otherwise approved by Borland Software Corporation.

Copyright ©2006-2007 RudeServer

Valid HTML 4.01 Transitional