Using the Free Command Line Compiler   
Introduction
The Course TextBook contains a companion CD-ROM. This CD-ROM contains a free command line C/C++ compiler. It's very simple to install and use. And, best of all it's free!

Below are instructions on getting started.

Step by Step Instructions

1. Insert the CD into your CD-drive.

The CD-Drive will automatically load. To install the free compiler, click Install Software --> Borland C++ Compiler --> Install Software.

Watch out for this:

When running from the CD, I received the following error: "The Specified File was not found...." If you receive this error, try doing this:

  • Double Click on the My Computer Icon
  • Right Click on your CD ROM Drive, and select "Explore"
  • Navigate to: BORLAND\CBUILD~5\COMMAN~5
  • Double click on the item named, "FREECO~6.EXE"

2. When the install program runs, it will ask you to specify an installation directory. I recommend using C:\Borland.

3. Next, you need to add Borland to your PATH Environment variable. This makes the compiler available to you no matter what directory you are in. Setting the PATH is different depending on which version of Windows you use. I have included instructions for the various flavors of Windows below:

A. Windows NT and Windows 2000

Start the Control Panel, select System, select Environment, and look for "Path" in the User Variables and System Variables. Append the following value to your existing PATH: C:\Borland\bcc55\Bin.

Then Click "Set", "OK" or "Apply".

The new path takes effect in each new Command Prompt window you open after setting the PATH variable.

B. Windows 98, Windows 95

Open the AUTOEXEC.BAT file and add or change the PATH statement as follows:

Start the system editor. Choose "Start", "Run" and enter sysedit, then click OK. The system editor starts up with several windows showing. Go to the window that is displaying AUTOEXEC.BAT.

Look for the PATH statement. (If you don't have one, add one.) If you're not sure where to add the path, add it to the right end of the PATH. For example, in the following PATH statement, we have added the Borland bin directory at the right end:

PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\Borland\bcc55\Bin

To make the path take effect in the current Command Prompt window, execute the following: C:> c:\autoexec.bat

To find out the current value of your PATH, to see if it took effect, at the command prompt, type: C:> path

4. Next, create a new file called "bcc32.cfg" and save it in C:\Borland\bcc55\Bin. The contents of the file should be set as follows:

-I"c:\Borland\Bcc55\include"
-L"c:\Borland\Bcc55\lib"

5. Next, create a new file called "ilink32.cfg" and save it in C:\Borland\bcc55\Bin. The contents of the file should be set as follows:

   
-L"c:\Borland\Bcc55\lib"

6. Open a new DOS Window: Start --> Run > cmd.exe

7. Create a directory for your C Programs:

mkdir c_programs

Then move to your c_programs directory:

cd c_programs

8. Create a sample C Program using your favorite text editor (see below for some suggestions.) Save the program to C:\c_programs\hello.c

/* Fig. 2.1: fig02_01.c
   A first program in C */
#include <stdio.h>

int main( void )
{
   printf( "Welcome to C!\n" );
   return 0;
} 

9. Compile your program:

bcc32 hello.c

10. Run your program:

hello.exe

You should see this:

Welcome to C!
Text Editors
A number of free text editors are available on the web. In the past, many students seem to like EditPlus, from EditPlus.com. You can download it for free.