Table of Contents
The job of the interpreter is to translate source code into machine instructions with the immediate execution. One of the popular language which uses the interpreter is the BASIC. Actually interpreters translate and execute one line at a time. But there are some disadvantages to this that is it forgets that the line has been translated. We would not go into detail because it is not the topic of discussion. For you information, BASIC has also been compiled for speed.
A compiler translates source code directly into machine instructions which is called a file or files containing machine code. This process takes several steps which is not an easy job to explain it in this life time history of C++ program. The generated programs run much more quickly. There is flexibility in some languages such as C and C++ to allow pieces of a program to be compiled independently. Eventually all the pieces are combined into one executable program by some other software called the linker.
Every C++ program is divided into four steps; edit time, compile time, and run time.
In order to create your first program, it is important to know the tools used to build applications.
- // program name: Hello.cpp
- Void main()
Programming in C++ involves four major steps in the process of compilation
- Text editor time
- link time
- run time
We need to use a text editor to write a C++ program, a program that creates or modifies files of text such as programs. The ultimate result of editing is a source file the one we commented out in the sample program hello.cpp. If we have made any mistake or for some reason which to modify the existing program, we use the text editor again to do the required job.
After we are all set with the source program, it is then given to another software program which is known as compiler to produce an object code if it is syntactically correct. The program under the name hello.cpp has four lines, which is the shortest possible program in C++ with a single line of output. Any C++ program which can be read and printed is known as a source file, and its readable contents are known as source code.
The object code is then given to the linker who combines the instructions or the list of object modules into an executable program which can then be loaded and run by the operating system (os) upon success. There is an important job for the linker and that is it searches through files called libraries in order to resolve all its references.
The last and final stage is the run-time. We execute the executable image to get the output “hello, world”. After getting the executable code successfully, the OS gives control to the memory to run the program. Remember the OS itself a program which occupies space in the memory and this part of the memory is called the resident memory.
List of C++ compilers & IDE’s
- wxDev C++
- Microsoft Visual C++
For Advance programmers:
- Eclipse CDT
- Borland C++