Translate

Tuesday, November 19, 2019

Process of Forming C++ Program


Process of Forming C++ Program

     Before proceesing further to the stage of making program code you should know in advance about the process of forming programs in C ++. There are several stages that occur during the process of forming a program, from program code to binary files that can be executed. In the Windows operating system, the program file will have an .exe extension. In Linux, usually the formation of a program is marked with the extension. Each stage is carried out by another different program, which is:

1.C ++ Prepocessor
2.C ++ Compiler
3.Assembler
4.Linker
5.After the program (.exe or .o file) is formed, the file can be executed or run (Run). The program that executes this file is called the Loader program.

C++ Preprocessor Program
     When forming a program written in C ++, the program code will first be processed by the C ++ Prepocessor program. This program will combine the program code with the prepocessor directive used in the code. Prepocessor directive is a program statement that starts with #.
     At this stage, the #include, #define, etc. statements will be converted into the actual code. For example, if there is a #include in the program code the entire contents of the "iostream" file will be included in the program code. Furthermore, the expanded code form is then ready to be sent to the C ++ Compiler program.

C++ Compiler Program
     The next step after the initial processing of the program code is the translation of program code into assembly code. The process at this stage is carried out by the C ++ Compiler program. Code that has been changed to the form of assembly code is then ready to be sent to the Assembler program.

C++ Assembler Program
     After the Assembler program receives the shipment in the form of assembly code from C ++ Compiler, this program will directly translate the code contained in it into object code. Furthermore, this object code will be sent to the Linker program.

C++ Linker Program
     If the program code we write is more than one file, the object code generated will also correspond to the number of program code files. At this stage, the Linker program will link all the object code files with the Standard Runtime Library that has been provided by C ++, then convert them into one .exe file (or. O). This file is called a program. At this stage, the formation of the program has ended.

C++ Loader Program
    Program Loader is a program used to execute programs that we have created. For example, in the Dev-C ++ application (IDE and C / C ++ Compiler that I use), when we use the Compile menu, Dev-C ++ will do the process of forming the program. Here what will be called are C ++ Prepocessor, C ++ Compiler, Assembler, and Linker programs. However, when using the Run menu, the Loader program will be called to execute the program that we have created so that the output of the program will be displayed on the monitor screen (console).

No comments:

Post a Comment