Appendix D: The C Builder Compiler


Borland sells a wide range of development tools. These tools are quite useful. However, many people, especially students just learning about programming, need something cheaper (preferably free!) to work with. Borland has been kind enough to provide a free command line compiler. It is the one used throughout most of this book (except for the chapters on Visual C++). This appendix will walk you through the download, installation, configuration, and use of this free compiler.

Step 1: The first step is to download the compiler. First, you will need to go the Borland Web site, where there is an entire page devoted to this free compiler.

http://www.borland.com/bcppbuilder/freecompiler/

You can simply click on “Try it Now” on the lefthand side of the screen, just as you see in Figure D.1.

Once you select that option you will be prompted to register with Borland, and then to download the compiler to your machine. What you actually download is a setup file that you will need to run. Figure D.2 is a picture of what it would look like if viewed in “My Computer” on a Windows PC.

Once you launch the application, it will ask you where you wish to install the product. This will look much like the image in Figure D.3.

Once the installation is done, you will have to configure the compiler. In whatever directory you install this compiler to you will notice the following items:

  1. A license.txt

  2. A readme.txt

  3. A Bin directory

  4. An Examples directory

  5. A Help directory

  6. A Lib directory

  7. An Include directory

Please note that, although this is a good compiler, the readme file is of almost no help at all. The first step you will have to do is to create two text files called bcc32.cfg and ilink32.cfg. These are configuration files that tell your compiler where to find things. To create them, open your favorite text editor and enter the following.

In bcc32.cfg  I"c:\Borland\Bcc55\include" L"c:\Borland\Bcc55\lib;

What these two lines will do is to tell the compiler where it can find include files, and libraries.

In ilink32.cfg L"C:\Borland\Bcc55\lib;

This line tells the linker where to find libraries that need to be linked-in when your program is compiled.

hint!

If you installed this to a different directory, then you will have to put the path to the following directory: c:\Borland\Bcc55\

You are almost ready. Now you just need to add this path to your system’s path variables. Path variables allow your operating system to know where to find things. This is done different ways for different operating systems. If you have Windows 2000, then you will go to Start > Control Panel > System, and choose the Advanced Tab. Next, click the Environment Variables button. Then select Path. This should look much like what you see in Figure D.4.

When you click the Edit button, you will see a path statement. At the very end, simply place the following line.

c:\Borland\BCC55\Bin. 

This should resemble the image you see in Figure D.5.

hint!

If you installed to a different directory, then please use that directory path.

Now you are set, and ready to compile!

If, however, you are using an older version of Windows, you can go to the DOS prompt and type-in the following.

Set path = %path%;c:\Borland\BCC55\Bin; 

For any operating system, you can simply consult the documentation of that operating system and find out how to set the path statement. What you are doing, whatever process is required, is letting the operating system know where the compiler is located, so that you can invoke it from anywhere on your PC. Now you will be able to compile your C++ programs. Simply save your code in a plain text file that ends with a .cpp extension. Then, from the command line, type-in the following.

bcc32 filename.cpp

When that is completed, if there are no errors in your code, you will then have an executable you can distribute: filename.cpp

If, however, you have errors, then you will need to correct those before you will be able to proceed.

If, for any reason, setting the path statement does not work, you can get around this by copying the source file you wish to compile to the folder where your compiler is:

C:\Borland\bcc55\bin\




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net