Home » C Programming » Tutorial » Compile C in GCC Compiler
Compile C Program using GCC compiler (linux)
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. C is one of the programming language which is supported by GCC compiler.
Steps to compile & execute C program
1. Create file helloworld.c using vi editor
VI editor is commonly used editor on Linux. There few more editors like VIM, Gedit which can be used to edit files. To use VI editor, launch the terminal on Linux and type "vi helloword.c" & press enter.
2. Now press "i" for insert mode and write basic hello world program.
3. Save the file using command ":wc" and compile it
Compile it using gcc command i.e "gcc helloworld.c", a.out file is created as output file.
Output of the program
The default output file produced by GCC is a.out, We can pass argument -o to give any name.
Specifying the output file name
NOTE - if there are more number of filse then it is good practice to compile the source code using Makefile
Video Compilation of C Programming using gcc compiler on Linux
C Tutorial
- History of C Language
- The First Program in C
- Compilation & Execution
- Compile C on Dev-C++
- Compile C on GCC Linux
- Variable & Data types
- Comments
- Storage Classes
- Conidtional Statements
- Switch Cases
- Loops (for, while, do-while)
- Arrays
- Pointers
- Function Pointer
- Strings & Library func
- Formated I/O
- Structure
- Enum
- Union
- File I/O
- Memory Management
- Error Handling
- Type Casting