• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install GCC Compiler on Debian 10 Linux

Written by Admin, Updated On January 6, 2020
debian, gcc
How to Install GCC Compiler on Debian 10 Linux

The GNU Compiler Collection (GCC) is an open-source collection of compilers and libraries. It includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D programming languages. GCC was originally written as the compiler for the GNU operating system. In this article explains how to install the GCC compiler on Debian 10 Buster. It’s same procedure to install for Debian-based distros.

Step 1 – Prerequisites#

Before you start installation, you must be logged in as a user with sudo privileges

Step 2 – Install GCC on Debian#

A build-essential package that contains the GCC compiler and other libraries and utilities which required for compiling software. By default, the default Debian repositories contain this build-essential package.

First, update the package list.

sudo apt update

Run the below command to install build-essential package.

sudo apt install build-essential

At this, point GCC compiler is successfully installed, you can verify by checking gcc version:

gcc --version

It should show output as below:

GCC version in output will different and depends when you installing.

gcc (Debian 8.3.0-1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GCC version in output will different and depends when you installing.

Step 3 – Compile a sample Program#

It’s very easy to compile c or c++ program using GCC. In this example, we will print simple text “Welcome GCC!”. Type following lines using your favorite text editor and create a new file.

nano test.c
#include <stdio.h>
int main()
{
  printf ("Welcome GCC!\n");
  return 0;
}

Save the file and run below command to compile it make executable:

gcc test.c -o test

You can see that, a new binary file test has been created in your current working directory. To execute the program run:

./test

It should show output as below:

Welcome GCC!

Conclusion#

You learned how to install GCC on your Debian 10 Buster. You can get more information about GCC, visit the official GCC Documentation.

If you have any question or feedback, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install and Use Curl on Debian 10 Linux
Next Article   How to Install Webmin on Debian 10 Linux

Related Posts

  • How to Change Hostname Debian 11

    How to Change Hostname on Debian 11

    February 3, 2023
  • How to Install Python 3.11 on Debian 11

    How to Install Python on Debian 11

    January 25, 2023
  • How to Install Mongodb on Debian 11

    How to Install MongoDB on Debian 11 Linux

    January 11, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Python 3.11 on Debian 11
    How to Install Python on Debian 11 January 25, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook