0% found this document useful (0 votes)
12 views

3.Compilation Process

Uploaded by

Durga Prasanna
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

3.Compilation Process

Uploaded by

Durga Prasanna
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

SNS COLLEGE OF

Kurumbapalayam (Po), Coimbatore – 641 107


TECHNOLOGY
An Autonomous Institution
Accredited by NBA – AICTE and Accredited by NAAC – UGC with A ‘ ’ Grade
Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai

COURSE NAME : 23CST101–PROBLEMSOLVING&CPROGRAMMING

I YEAR / I SEMESTER

Unit 2-C PROGRAMMING BASICS

Topic : Compilation and linking process

1
C- compiler

There are many compilers available for c and c++. You need to
download any one. Here, we are going to use Turbo C++
.

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 2
B/AIML/SNSCT
Compilation process in C

• The compilation process can be divided into four steps, i.e., Pre-processing,
Compiling, Assembling, .and Linking.

• The following are the phases through which our program passes before
being transformed into an executable form:

1. Preprocessor

2. Compiler

3. Assembler

4. Linker

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 3
B/AIML/SNSCT
Compilation process in c

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 4
B/AIML/SNSCT
Compilation process in c

Preprocessor .

• The source code is the code which is written in a text


editor and the source code file is given an extension ".c".

• This source code is first passed to the preprocessor, and


then the preprocessor expands this code.

• After expanding the code, the expanded code is passed to


the compiler.
PROBLEM SOLVINGAND C PROGRAMMING/
05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 5
B/AIML/SNSCT
Compilation process in c

Compiler
.
• The code which is expanded by the
preprocessor is passed to the compiler. The
compiler converts this code into assembly code.

• Or can say that the C compiler


we the pre-processed code into
converts
assembly code.

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 6
B/AIML/SNSCT
Compilation process in c

Assembler
.
• The assembly code is converted into object
code by using an assembler. The name of the
object file generated by the assembler is the same
as the source file.
• The extension of the object file in DOS is '.obj,'
and in UNIX, the extension is 'o'. If the name of
the source file is 'hello.c', then the name of the
object file would be 'hello.obj'.
PROBLEM SOLVINGAND C PROGRAMMING/
05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 7
B/AIML/SNSCT
Compilation process in c

Linker
.
• Mainly, all the programs written in C use library functions.

• These library functions are pre-compiled, and the object


code of these library files is stored with '.lib' (or '.a')
extension.

• Therefore, we conclude that the job of the linker is to link


the object code of our program with the object code of the
library files and other files.

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 8
B/AIML/SNSCT
Compilation process in c

Let's understand through an example.

hello.c .

#include <stdio.h>

int main()

printf("Hello javaTpoint");

return 0;

} PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 9
B/AIML/SNSCT
Compilation process in c

PROBLEM SOLVINGAND C PROGRAMMING/


05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 10
B/AIML/SNSCT
THANK YOU

PROBLEM SOLVINGAND C PROGRAMMING/


04/12/2024
05/12/2024 COMPILATION LINKING PROCESS / DURGALAKSHMI 11
B/AIML/SNSCT

You might also like