Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Introduction to Compilation Stages | Introduction to Preprocessing
C Preprocessing

bookIntroduction to Compilation Stages

Preprocessing is the first stage of program compilation. But before diving into it, we need to look under the hood of the compilation process itself and understand why it's so essential. Compilation typically consists of four stages.

Preprocessing

Preprocessing involves replacing parts of your code with other code through textual substitution. For example, when you use #include <stdio.h>, the preprocessor replaces this line with the contents of the "stdio.h" file.

This step prepares the source code for the subsequent compilation process. Internally, the output of this stage is typically a file with the .i or .ii extension (intermediate file).

Translation

After preprocessing, the compiler takes the cleaned-up code of your program, checks it for syntax and semantic errors, and translates it into assembly code - code at a lower level than C-code.

The compiler creates an assembly file with the extension .s, which contains code for a specific processor architecture.

Assembly

An object file allows the compiler to generate machine code for each source file separately. This simplifies the development of large projects, because if only one source file is changed, only that file needs to be recompiled, rather than the entire program.

An object file has the extension .o. This file contains machine instructions, but it cannot yet simply be "run" because it still depends on other files and libraries. This file is not human readable.

Linking

In this last step, the linker takes all the object files and libraries that the program needs and combines them into an one executable file with the extension .exe for Windows and without the extension on Unix-like systems.

After this step, you can simply click on your Program.exe and it will work.

question mark

Select the correct sequence of compilation steps in C:

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 1

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Запитайте мені питання про цей предмет

Сумаризуйте цей розділ

Покажіть реальні приклади

Awesome!

Completion rate improved to 5.56

bookIntroduction to Compilation Stages

Свайпніть щоб показати меню

Preprocessing is the first stage of program compilation. But before diving into it, we need to look under the hood of the compilation process itself and understand why it's so essential. Compilation typically consists of four stages.

Preprocessing

Preprocessing involves replacing parts of your code with other code through textual substitution. For example, when you use #include <stdio.h>, the preprocessor replaces this line with the contents of the "stdio.h" file.

This step prepares the source code for the subsequent compilation process. Internally, the output of this stage is typically a file with the .i or .ii extension (intermediate file).

Translation

After preprocessing, the compiler takes the cleaned-up code of your program, checks it for syntax and semantic errors, and translates it into assembly code - code at a lower level than C-code.

The compiler creates an assembly file with the extension .s, which contains code for a specific processor architecture.

Assembly

An object file allows the compiler to generate machine code for each source file separately. This simplifies the development of large projects, because if only one source file is changed, only that file needs to be recompiled, rather than the entire program.

An object file has the extension .o. This file contains machine instructions, but it cannot yet simply be "run" because it still depends on other files and libraries. This file is not human readable.

Linking

In this last step, the linker takes all the object files and libraries that the program needs and combines them into an one executable file with the extension .exe for Windows and without the extension on Unix-like systems.

After this step, you can simply click on your Program.exe and it will work.

question mark

Select the correct sequence of compilation steps in C:

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 1
some-alt