SlideShare a Scribd company logo
2
Most read
6
Most read
7
Most read
1
GCC Compiler
Presented by: Anil pokhrel
BscCSIT 6th semester
2
Contents
• History of GCC
• Introduction to GCC
• Options in GCC
• Conclusion
History of GCC
• The original GNU C Compiler (GCC) is
developed by Richard Stallman, the founder of
the GNU Project.
• Richard Stallman founded the GNU project in
1984 to create a complete Unix-like operating
system as free software, to promote freedom
and cooperation among computer users and
programmers.
4
Introduction to GCC
• Stands for GNU C/C++ Compiler
• A popular console-based compiler for *NIX platforms
and others; can cross-compile code for various
architectures
• gcc to compile C programs;
• g++ for C++
• can actually work with also Java and a couple other
languages
GCC compiler
To compile: -c
1. gcc performs compilation and assembly of the source
file without linking.
2. The output are usually object code files, .o; they can
later be linked and form the desired executables.
3. Generates one object file per source file keeping the
same prefix (before .) of the filename.
4. gcc main.c
Options: -o <filename>
• Places resulting file into the filename specified instead
of the default one.
• Can be used with any generated files (object,
executables, assembly, etc.)
• If you have the file called source.c; the defaults are:
• source.o if -c was specified
• a.out if executable
• These can be overridden with the -o option.
• gcc main.c -o main
Options: -g
•Includes debugging info in the generated object code.
This info can later be used in gdb.
•gcc allows to use -g with the optimization turned on (-O)
in case there is a need to debug or trace the optimized
code.
Options: -Wall
• Shows most of the warnings related to possibly incorrect code.
• Wall is a combination of a large common set of the -W options
together. These typically include:
• unused variables
• possibly uninitialized variables when in use for the first time
• defaulting return types
• missing braces and parentheses in certain context that make
it ambiguous
• etc.
Options: -ansi
• For those who are picky about standard compliance
and to ensures the code compiled complies with the
ANSI C standard;
• These options can be quite annoying for those who
don’t know C well since gcc will refuse to compile
unkosher C code, which otherwise it has no problems
with.
• $ gcc -Wall -ansi main.c -o main
Conclusion
Refferences
• https://www.geeksforgeeks.org/gcc-command-in-linux-
with-examples/
• https://www.rapidtables.com/code/linux/gcc.html
• https://en.wikipedia.org/wiki/GNU_Compiler_Collection
• https://www.thegeekstuff.com/2012/10/gcc-compiler-
options/
13

More Related Content

What's hot (20)

ODP
GCC, GNU compiler collection
Alberto Bustamante Reyes
 
PDF
Run time storage
Rasineni Madhan Mohan Naidu
 
PDF
Regular expression in javascript
Toan Nguyen
 
PPT
7.data types in c#
Zeeshan Ahmad
 
PPTX
Namespaces in C#
yogita kachve
 
PDF
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
PPTX
GCC
Kir Chou
 
PPT
Introduction to C++
Bharat Kalia
 
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
PDF
Object oriented programming c++
Ankur Pandey
 
PPT
Concept of compiler in details
kazi_aihtesham
 
PDF
Principles of programming languages. Detail notes
VIKAS SINGH BHADOURIA
 
PDF
Object-oriented Programming-with C#
Doncho Minkov
 
PPTX
jQuery PPT
Dominic Arrojado
 
PPT
Files in c++ ppt
Kumar
 
PPTX
Visual Programming
Bagzzz
 
PPTX
C# Asynchronous delegates
Prem Kumar Badri
 
PPTX
Code Optimization
Akhil Kaushik
 
PPTX
Assemblies
Janas Khan
 
GCC, GNU compiler collection
Alberto Bustamante Reyes
 
Run time storage
Rasineni Madhan Mohan Naidu
 
Regular expression in javascript
Toan Nguyen
 
7.data types in c#
Zeeshan Ahmad
 
Namespaces in C#
yogita kachve
 
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
Introduction to C++
Bharat Kalia
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
Object oriented programming c++
Ankur Pandey
 
Concept of compiler in details
kazi_aihtesham
 
Principles of programming languages. Detail notes
VIKAS SINGH BHADOURIA
 
Object-oriented Programming-with C#
Doncho Minkov
 
jQuery PPT
Dominic Arrojado
 
Files in c++ ppt
Kumar
 
Visual Programming
Bagzzz
 
C# Asynchronous delegates
Prem Kumar Badri
 
Code Optimization
Akhil Kaushik
 
Assemblies
Janas Khan
 

Similar to GCC compiler (20)

PPTX
G++ & GCC
Beste Ekmen
 
PDF
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io
 
PPTX
Comparing C and Go
Marcin Pasinski
 
PDF
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Ahmed El-Arabawy
 
PPTX
Autotools pratical training
Thierry Gayet
 
PDF
Programming in Linux Environment
Dongho Kang
 
PPTX
Unit i
vijay gupta
 
PDF
Introduction to the LLVM Compiler System
zionsaint
 
DOC
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
PDF
DEVNET-2006 Coding 210: Parsing JSON in C++
Cisco DevNet
 
PPTX
Basics of C Lecture 2[16097].pptx
CoolGamer16
 
PPTX
C++Basics2022.pptx
Danielle780357
 
PPTX
GNU Debugger
Gizem Çetin
 
PPTX
Gnu debugger
Gizem Çetin
 
PPTX
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
PPTX
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
PDF
C som-programmeringssprog-bt
InfinIT - Innovationsnetværket for it
 
PDF
Linux programming
Abhinav Upadhyay
 
PDF
cgo and Go plugins
strikr .
 
G++ & GCC
Beste Ekmen
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io
 
Comparing C and Go
Marcin Pasinski
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Ahmed El-Arabawy
 
Autotools pratical training
Thierry Gayet
 
Programming in Linux Environment
Dongho Kang
 
Unit i
vijay gupta
 
Introduction to the LLVM Compiler System
zionsaint
 
Introduction-to-C-Part-1 (1).doc
MayurWagh46
 
DEVNET-2006 Coding 210: Parsing JSON in C++
Cisco DevNet
 
Basics of C Lecture 2[16097].pptx
CoolGamer16
 
C++Basics2022.pptx
Danielle780357
 
GNU Debugger
Gizem Çetin
 
Gnu debugger
Gizem Çetin
 
Introduction-to-C-Part-1.pptx
NEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 
C som-programmeringssprog-bt
InfinIT - Innovationsnetværket for it
 
Linux programming
Abhinav Upadhyay
 
cgo and Go plugins
strikr .
 
Ad

More from Anil Pokhrel (20)

PPTX
System software
Anil Pokhrel
 
PPTX
Internet and intranet
Anil Pokhrel
 
PPTX
Measure of dispersion
Anil Pokhrel
 
PPTX
Correlation and regression
Anil Pokhrel
 
PPTX
Correlation analysis
Anil Pokhrel
 
PPTX
Function in C Programming
Anil Pokhrel
 
PPTX
2 dimension array in programms
Anil Pokhrel
 
PPTX
Priority scheuling
Anil Pokhrel
 
PPTX
Operating system file system
Anil Pokhrel
 
PPTX
object oriented programming OOP
Anil Pokhrel
 
PPTX
Numerical method runge kutta method
Anil Pokhrel
 
PPTX
Management profile ppt
Anil Pokhrel
 
PPTX
Impact of error
Anil Pokhrel
 
PPTX
Control statement
Anil Pokhrel
 
PPTX
Bus and memory transfer
Anil Pokhrel
 
PPTX
Computer architecture data representation
Anil Pokhrel
 
PPTX
Management and leadership skills
Anil Pokhrel
 
PPTX
color detection using open cv
Anil Pokhrel
 
PPTX
Client-server technology in web design
Anil Pokhrel
 
PPTX
Software Engineering requirements
Anil Pokhrel
 
System software
Anil Pokhrel
 
Internet and intranet
Anil Pokhrel
 
Measure of dispersion
Anil Pokhrel
 
Correlation and regression
Anil Pokhrel
 
Correlation analysis
Anil Pokhrel
 
Function in C Programming
Anil Pokhrel
 
2 dimension array in programms
Anil Pokhrel
 
Priority scheuling
Anil Pokhrel
 
Operating system file system
Anil Pokhrel
 
object oriented programming OOP
Anil Pokhrel
 
Numerical method runge kutta method
Anil Pokhrel
 
Management profile ppt
Anil Pokhrel
 
Impact of error
Anil Pokhrel
 
Control statement
Anil Pokhrel
 
Bus and memory transfer
Anil Pokhrel
 
Computer architecture data representation
Anil Pokhrel
 
Management and leadership skills
Anil Pokhrel
 
color detection using open cv
Anil Pokhrel
 
Client-server technology in web design
Anil Pokhrel
 
Software Engineering requirements
Anil Pokhrel
 
Ad

Recently uploaded (20)

PPTX
Power BI - The future of Data Presentation and Visualizations
Techera
 
PPTX
BOILER STEAM bana M ntpc kahalgaon boiler .pptx
didikesaadi1108
 
PPTX
www ecommerce web based architecture.pptx
revathi148366
 
PPTX
Turn prompts into brochures - AI Brochure Generator
Venngage AI Infographic Generator
 
PDF
Balance Your Home with These Vastu Tips!
https://homzinterio.in/
 
PPTX
Pendant Lights, Types and their applications
Disha Agrawal
 
PPTX
search engine optimization123244556.pptx
revathi148366
 
PPTX
QBDqbdqbdqbdqbdqbdqbdqbdqbdqbqdbqd .pptx
komoja3525
 
PPTX
ai teaching assistant for visual learning.pptx
jamesmay2663
 
PDF
ABS system PPT 2025 for used automatic backing system .pdf
altron1331
 
PPT
Seminar FRP Materials.strenthening using frp
MohamedAttia601252
 
PDF
Graphic Designing Article All about Graphic Designing
Techera
 
PPTX
PTC '25.pptx VXFGHDZDGDRYRIYUUOIUOPIO'KL
JorrehtyMRegondola
 
PPTX
class 11-B Chemistry of black and white photography by Kshitiz Sajwan.pptx
opkaddusajwan
 
PDF
Favorite Looks Menswear Spring Summer 2026
Ana Andjelic
 
PPTX
原版加拿大亚岗昆学院毕业证(AC毕业证书)如何办理
Taqyea
 
PPTX
Design_Guidelinescarrr_Presentation.pptx
kikajic949
 
PPTX
4. PMES PORTFOLIO_BROWN DESIGN_T1-T3_A4.pptx
GynnelNicanor1
 
PPTX
ArchitectingOnAWS_Module_13 goat bumrah i
m23aid005
 
PPTX
Presentationghjgghjhg (11)hcpckxgjt.pptx
ishafarikarbel
 
Power BI - The future of Data Presentation and Visualizations
Techera
 
BOILER STEAM bana M ntpc kahalgaon boiler .pptx
didikesaadi1108
 
www ecommerce web based architecture.pptx
revathi148366
 
Turn prompts into brochures - AI Brochure Generator
Venngage AI Infographic Generator
 
Balance Your Home with These Vastu Tips!
https://homzinterio.in/
 
Pendant Lights, Types and their applications
Disha Agrawal
 
search engine optimization123244556.pptx
revathi148366
 
QBDqbdqbdqbdqbdqbdqbdqbdqbdqbqdbqd .pptx
komoja3525
 
ai teaching assistant for visual learning.pptx
jamesmay2663
 
ABS system PPT 2025 for used automatic backing system .pdf
altron1331
 
Seminar FRP Materials.strenthening using frp
MohamedAttia601252
 
Graphic Designing Article All about Graphic Designing
Techera
 
PTC '25.pptx VXFGHDZDGDRYRIYUUOIUOPIO'KL
JorrehtyMRegondola
 
class 11-B Chemistry of black and white photography by Kshitiz Sajwan.pptx
opkaddusajwan
 
Favorite Looks Menswear Spring Summer 2026
Ana Andjelic
 
原版加拿大亚岗昆学院毕业证(AC毕业证书)如何办理
Taqyea
 
Design_Guidelinescarrr_Presentation.pptx
kikajic949
 
4. PMES PORTFOLIO_BROWN DESIGN_T1-T3_A4.pptx
GynnelNicanor1
 
ArchitectingOnAWS_Module_13 goat bumrah i
m23aid005
 
Presentationghjgghjhg (11)hcpckxgjt.pptx
ishafarikarbel
 

GCC compiler

  • 1. 1 GCC Compiler Presented by: Anil pokhrel BscCSIT 6th semester
  • 2. 2 Contents • History of GCC • Introduction to GCC • Options in GCC • Conclusion
  • 3. History of GCC • The original GNU C Compiler (GCC) is developed by Richard Stallman, the founder of the GNU Project. • Richard Stallman founded the GNU project in 1984 to create a complete Unix-like operating system as free software, to promote freedom and cooperation among computer users and programmers.
  • 4. 4 Introduction to GCC • Stands for GNU C/C++ Compiler • A popular console-based compiler for *NIX platforms and others; can cross-compile code for various architectures • gcc to compile C programs; • g++ for C++ • can actually work with also Java and a couple other languages
  • 6. To compile: -c 1. gcc performs compilation and assembly of the source file without linking. 2. The output are usually object code files, .o; they can later be linked and form the desired executables. 3. Generates one object file per source file keeping the same prefix (before .) of the filename. 4. gcc main.c
  • 7. Options: -o <filename> • Places resulting file into the filename specified instead of the default one. • Can be used with any generated files (object, executables, assembly, etc.) • If you have the file called source.c; the defaults are: • source.o if -c was specified • a.out if executable • These can be overridden with the -o option. • gcc main.c -o main
  • 8. Options: -g •Includes debugging info in the generated object code. This info can later be used in gdb. •gcc allows to use -g with the optimization turned on (-O) in case there is a need to debug or trace the optimized code.
  • 9. Options: -Wall • Shows most of the warnings related to possibly incorrect code. • Wall is a combination of a large common set of the -W options together. These typically include: • unused variables • possibly uninitialized variables when in use for the first time • defaulting return types • missing braces and parentheses in certain context that make it ambiguous • etc.
  • 10. Options: -ansi • For those who are picky about standard compliance and to ensures the code compiled complies with the ANSI C standard; • These options can be quite annoying for those who don’t know C well since gcc will refuse to compile unkosher C code, which otherwise it has no problems with. • $ gcc -Wall -ansi main.c -o main
  • 12. Refferences • https://www.geeksforgeeks.org/gcc-command-in-linux- with-examples/ • https://www.rapidtables.com/code/linux/gcc.html • https://en.wikipedia.org/wiki/GNU_Compiler_Collection • https://www.thegeekstuff.com/2012/10/gcc-compiler- options/
  • 13. 13