5: STAGES OF C++

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

Stages of C++

  1. Preprocessing

  2. Compilation

  3. Assembly

  4. Linking Execution

2
New cards

Preprocessing

Compilation

Assembly

Linking Execution

Stages of C++

3
New cards

Preprocessing

  • Handles all preprocessor directives (line starting with #, e.g., @#include, #define

  • Expands macros, removes comments, and includes header files

  • Output: a pure C++ source file (no directives, everything expanded)

4
New cards

Preprocessing

Output: a pure C++ source file (no directives, everything expanded)

5
New cards

Pure C++ Source File

Output of the Preprocessing Stage

6
New cards

Compilation

  • The ___ translates the preprocessed source code into assembly language (human readable low-level code specific to the CPU

  • Checks for syntax errors and converts high-level C++ constructs into lower level instructions

  • Output: Assembly Code

7
New cards

Compilation

Output: Assembly Code

8
New cards

Assembly Code

The output of the Compilation stage

9
New cards

Assembly

  • The ___ converts the ___ code into object code

    • e.g.) machine code, binary format, but not yet executable

  • This is stored in an object file (.o or .obj)

  • Contains: machine instructions, symbol table (function/variable references not yet linked

10
New cards

Assembly

  • Contains: machine instructions, symbol table (function/variable references not yet linked

11
New cards

Assembly

Converts ___ code to object code

12
New cards

Linking

  • The ___ combines object files and required libraries like <iostream>

  • Resolves external references like cout, cin, or functions defines in other files

  • Produces a final executable file (.exe, no extention, or .out)

13
New cards

Linking

  • Produces a final executable file (.exe, no extention, or .out)

14
New cards

Executable File

Output of the Linking Stage

15
New cards

Execution

  • The ___ file is loaded into memory by the operating system

  • The CPU executes the machine instructions

  • Program runs and produces output