Engineering Science 1036A/B Lecture Notes - Lecture 4: Object Code, Integrated Development Environment, Binary File
Text Editor
The program (source code) is written using the text editor
•
Source code is saved in to the secondary storage (external memory) with an
extension ".cpp" to let the complier know that it is written in C++ language
•
Source code needs to be grammatically correct
•
Preprocessor
program that modifies source code by:
by adding other files
○
performing various text replacements in the existing code
○
•
It executes automatically before the compilation starts
Compilation follows after preprocessing, so none can access the
modifications made by the preprocessor
○
•
Complier
Translates source code into an object code that contains machine readable
instructions
Object code is saved on to the disk by the compiler with an extension
".obj" along with the same source-code name
○
The file is a binary file
○
•
Linker
Scans the library that the preprocessor directives have included
Libraries: collection of functions/objects
○
•
Selects the needed function or object (precompiled)•
Upon linking them into the object file, it produces an executable file with
extension ".exe" and stores it on the disk
•
Loader
Places the executable file on to the internal memory (RAM), from where the
CPU executes the program, instruction by instruction
•
Debugger
Locates the problem in the program during the compilation time•
Integrated Development Environment (IDE)
Combines editor, compiler, linker and debugger into a single development
environment
•
Errors
Syntax Errors (parse, compilation error)
Reported by compiler•
Program will not compile with erroneous syntax•
Runtime errors (Execution error)
Occurs when the programming environment detects an operation that is
impossible to carry out during program execution
•
Generally encountered due to memory mismanagement issue•
Logical errors (or program bugs)
occur when a program doesn't perform the way it is expected to perform•
Linker errors
Reported by the linker•
Occurs when some function or library that is needed cannot be found•
Converting C++ in to Machine Language