Programming Books

Main Menu

  • Home
  • Phyton programming
  • Java programming
  • Php programming
  • C++ programming
  • Additional Topics
    • Programming industry
    • Privacy Policy
    • Terms and Conditions

Programming Books

Header Banner

Programming Books

  • Home
  • Phyton programming
  • Java programming
  • Php programming
  • C++ programming
  • Additional Topics
    • Programming industry
    • Privacy Policy
    • Terms and Conditions
C++ programming
Home›C++ programming›Guide: Running a C Compiler on Linux

Guide: Running a C Compiler on Linux

By Brandy J. Richardson
November 21, 2021
0
0


This tutorial is for Guide: Running a C Compiler in Linux. We will do our best to make sure you understand this guide. I hope you will like this blog Guide: Running a C Compiler on Linux. If your answer is yes, please share after reading this.

Verification Guide: Running a C Compiler on Linux

While building the Linux kernel, the developers had to create a free open source compiler to create the kernel and modules. The GCC compiler was created as part of the GNU Project. In the current version of all Linux distributions, the GCC compiler is pre-installed in the operating system. You can use the GCC compiler to compile C, C ++, Ada, Go, and other object-oriented programming languages. You can compile code in your terminal shell using the GCC compiler on a Linux system.

We ran the steps and commands mentioned in this article on an Ubuntu 20.04 LTS system, but it works exactly the same on other versions like Ubuntu 18.04 or distributions like Debian 10.

We are going to use the Linux terminal command line tool to compile a simple C program. To open Terminal, you can use Ubuntu Dash or the keyboard shortcut Ctrl + Alt + T.

Install essential build packages

To compile and run a C program, you must have the essential packages installed on your system. Enter the following command as root on your Linux terminal:

$ sudo apt-get install build-essential

You will be asked to enter the root password; the installation process will start after that. Make sure you are connected to the Internet.

Write a simple program in C

After installing the essential packages, let’s write a simple C program. Open the Ubuntu graphical text editor and type or copy the following sample program into it:

#understand

int main () {printf (“nAn example C program nn”); returns 0;}

Then save the file with the extension .c.

Alternatively, you can write the C program through Terminal in gedit as follows:

$ gedit sampleProgram.c This will create a .c file in which you can write and save a program.

Compile the C program with the gcc compiler

In your Terminal, enter the following command to create an executable version of the program you wrote: Syntax: $ gcc [program Name].c -o Program name

Make sure your program is in your Startup folder. Otherwise, you will need to specify the appropriate paths in this command.

Run the program

The last step is to run the compiled C program. Use the following syntax to do this:

$ ./ program name

You can see how the program runs in the example above, showing the text we wrote to print it.

Final words: Guide: Running a C compiler on Linux

hope you will understand this item Guide: Running a C Compiler on Linux, if your answer is no, you can request anything through the contact forum section linked to this article. And if your answer is yes, then share this article with your family and friends.


Related posts:

  1. Youth inmates in Cuyahoga County face unacceptable conditions: Leah Winsberg
  2. Python ranks most popular programming language for the first time in 20 years
  3. Top 10 C ++ frameworks for machine learning in 2021
  4. These are the 6 most in-demand tech jobs that South African companies are struggling to recruit
Tagsobject orientedprogramming languages

Archives

  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • January 2021
  • December 2019
  • November 2019
  • October 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2017

Categories

  • C++ programming
  • Java programming
  • Php programming
  • Phyton programming
  • Programming industry

Recent Posts

  • Rust could be included in the Linux kernel in 5.20
  • [Around the Hotels] Promotions and packages
  • AWS Mainframe Modernization Service Now Generally Available
  • Rates rise for private student loans, but borrowers with good credit can still save
  • Lycoming College student secures his future with the Ministry of Defense | Education
  • Privacy Policy
  • Terms and Conditions