Setting Up the Turbo C Development System
in this section, we briefly introduce the components of the Turbo C development system, and make some suggestions for setting it up so you can compile the programs.
Integrated Development Environment (IDE)
It is also referred to as the programmer's platform. it is a screen display with window and pull down menus. the program listing, its output, error messages, and other information are displayed in separate windows. You use menu selections or key combinations to invoke all the operations necessary to develop your program, including editing, compiling, linking and program execution.
Files Used in C Program Development
Executable files are stored in the sub-directory BIN. The most important executable file is TC.Exe, executing that places the IDE on your screen. The BIN directory also contains programs for the command line development process.
Library and Run Time Files
Various files are combined with your program during linking. these files contain routines for a wide variety of purposes. There are library files, run-time object files, and math library files. They are all store in the LIB directory.
Library Files
Library files are groups of pre-compiled routines for performing specific tasks. For example if a programmer uses a function such as printf() to display text on the screen, the code to create the display is contained in a library file. A library file has a unique characteristic, only those parts of it that are necessary will be linked to a program.
Header Files
The sub-directory called include contains header files. Header files can be combined with your program before it is compiled. Header files serve several purposes. You can place statements in your program listing that are not program code but are instead messages to the compiler. These messages, called compiler directories can tell the compiler such things as the definition of words or phrases used in your program. Each header file has a .h extension.
Writing a program
void main (void)
{
printf("this is my first program");
}
Saving the Program
After you have typed in the source file for the program, you should save it to your disk. To do this, select Save from the File menu or by pressing the F2 function key.
Making an .exe File
After you have written the source file for your program, you need to turn it into an executable file. This is called "Making" the .exe file.
Compiling
The version of the program you typed in is understandable to human beings. however it is not understandable to the microprocessor in your computer. A program that is to be executed by the microprocessor must be in the form of a machine language file. So there must be two versions of the program, the one you type in, which is called source file, and the machine language version, which is called executable or binary file.
the compiler, which is a part of the IDE, translates this source code into another file, consisting of machine language.
Linking
Linking is necessary for several reasons. First your program need to be combined with various library routines. Second Larger C programs commonly consist of several separate files, some of which may already be compiled The linker combines these files into a single executable file. Linker is built into Turbo C IDE.
Executing a Program
If there were no errors in the compiling or linking process, you are now ready to run the program. You can do this from the IDE by selecting Run from the Run menu, or by pressing the Ctrl, F9 key combination.