Borland C Compiler SetupMacOS, Windows, Linux installations, settings, and tutorial.Mar 24, 2006 Guy Lecky-Thompson
Tutorial to help install the free Borland C compiler, get it up and running, and write a simple command line application.
Borland C Tutorial - Lesson 1 In this Borland C tutorial lesson we shall learn how to check that the Borland C compiler is correctly installed, and take our first steps with the C language, using the 'Hello World' application in the time honoured tradition of all programming tutorials. We are using the free Borland C compiler because it is powerful, flexible, and allows us to create software for both command line and GUI (Windows) applications. Of course, the first thing that you will need to do is download the Borland C compiler (explained in the Free Programming Tools article, and install it following the instructions received during the download process. Before we continue, we should point out that only the C language tutorial part of this free C tutorial is valid for MacOS users, since it is targeted towards the free Borland C compiler available for Windows and Linux. Checking your installation The first thing that we need to do is ensure that your free Borland C environment is correctly installed. To do this, call up a command prompt, and type 'make'. The Borland C environment should produce a message along the lines of: MAKE Version 5.2 Copyright (c) 1987, 2000 Borland If an error message appears such as 'make is not recognised as an internal or external command ...', then the Borland C environment has not been set up correctly. Linux users will know how to fix this, but on the Windows operating system family, it is a little less straightforward. Typing 'path' will reveal that the install paths for your Borland C compiler have not been added to the system variables. Specifically, the 'bcc55\bin' folder needs to be added (mine is c:\borland\bcc55\bin') to the environment string. Open the Control Panel (Start-Settings, Control Panel on post-Windows 95 machines) and find the System Properties entry. Double-clicking it brings up a dialog box containing a variety of tabs, among them 'Advanced'. Once this is selected the Environment Variables button can be clicked. Finally, in the resulting dialog box, in the System Variables list box, locate the 'Path' variable, click 'Edit', and type your path (:\\bcc55\bin), not forgetting to append a semi-colon (;). Checking again via the command prompt, we can now see that typing 'make' does what we would expect. C Tutorial - Hello World! With the preparation out of the way, we can now write our first application - called Hello World. Using your text editor of choice, type in the following: #include // Using the C I/O Libraries void main ( void ) // The 'entry point' to the program { // Display text, and add a linefeed printf("Hello World!\n"); } The above may seem simple, but there are few items to take note of:
All the work is done inside the main function; and must be contained within braces ('}'). Useful programs, that output to the screen, will usually #include the stdio.h functions. Save your program in a suitable text file (HelloWorld.c - note the .c extension), and turn it into a command line application by:
Possible problems can be solved in one of two ways - trial and error, or using the Computer Programming discussions below to ask specific questions. The most usual is when the file has been named HelloWord.c.txt by the text editor, leading to: Error 2194 : Could not find the file 'HelloWorld.c' Renaming the file (rename HelloWorld.c.txt HelloWorld.c) will help in this case. Questions To help you get the most out of this Borland C tutorial, here are a few questions to ponder before reading Lesson 2:
(Hint : for that last one, if you're still using cut'n'paste, it's not the right answer!) Answers via the mailing list, as well as an advance copy of the Lessons, as they arrive. Continue to Lesson 2 : Loops..
The copyright of the article Borland C Compiler Setup in Computer Programming is owned by Guy Lecky-Thompson. Permission to republish Borland C Compiler Setup in print or online must be granted by the author in writing.
Comments Jan 3, 2009 4:20 PM
Guest :
1 Comment:
Related Topics
Reference
More in Technology
|