Borland C++ compiler

Borland is one company that creates compilers. In the past, they released a version of C++ called Turbo C++ that was popular for programming in the DOS enironment, and you may find some books still come with that compiler.



Embarcadero's webpage has information on their compilers, as well as some free downloads of their earlier compilers (though you probably don't want to use those as they are out of date). They are now giving away a new version of their compiler, Borland C++ 5.5 for free download. It does require you to become a member of the borland community before downloading the file, but this registration takes place immediately.

Note that this compiler is a command-line tool: you will need to feel comfortable running it from the DOS prompt, or set up an "IDE" (integrated developer's environment).

Setting up Your Compiler

Once you've downloaded the Borland compiler, you can take take the default installation options, including the default directory, "c:\Borland\BCC55". Once you've done that, follow the instructions below to get the compiler ready to use.
  • First, we need to tell the compiler where to find the include files and supporting libraries. To do this, open up notepad (or any other text editor) and paste the following two lines into a blank file:
    -I"c:\Borland\Bcc55\include"
    -L"c:\Borland\Bcc55\lib"
    
  • Save this file in notepad as "c:\borland\bcc55\bin\bcc32.cfg". To do this, just go to "Save As" under the "File" menu, then type the entire file name, in quotes, into notepad. You need to include the quotes to keep it from adding a .txt extension.
  • Now paste the following line into a new blank text file:
    -L"c:\Borland\Bcc55\lib"
  • Save this new file as "c:\borland\bcc55\bin\ilink32.cfg"
Great, now you're ready to start writing and compiling programs.

Compiling and Testing your Installation

Since Borland C++ 5.5 is a command-line tool, you will need to run it from the command line. Before trying to compile a program, you'll need to actually write some code to test the compiler. You can do this in notepad, or download a better text editor. At any rate, you'll want to save the file in the "c:\borland\bcc55\bin" directory. If you save it in notepad, be sure to enclose the name in quotes to make it a ".cpp" file instead of a ".txt" file.

Here's a simple program you can copy into notepad and save as "c:\borland\bcc55\bin\test.cpp" to test your compiler's installation:
#include <iostream>

int main()
{
    std::cout<< "I work!" << std::endl;
}
Borland C++'s compiler is actually named "bcc32" and it is located in the "c:\borland\bcc55\bin" directory; the below instructions will take you through compiling your first program.

Compiling the program

  • Go to start, click on run, and type "Command", and hit enter.
  • Now, type "cd c:\borland\bcc55\bin" and hit enter.
  • You should be in the above directory now (your prompt should read: "c:\Borland\BCC55\Bin"); if not, check that you typed it correctly.
  • Type in "bcc32 test.cpp" and hit enter. This should result in the following output if everything worked:
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    test.cpp:
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    
    which means that it worked.
  • You can now run your test program by typing "test.exe" and hitting enter. You should see the text:
    I work!