• 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 11

Written by Admin, Updated On January 12, 2023
apache, debian, gcc
How to Install Gcc on Debian 11

GCC stands for GNU Compiler Collection. It 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. This guide explains how to install GCC compiler on Debian 11 Bullseye. It’s same procedure to install for Debian-based distros.

Perform the following steps to install GCC on Debian 11:

Step 1 – Prerequisites#

Before you start installation, you must be login 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, build-essential package is included in default Debian repositories.

At first, to update the package list use the following command:

sudo apt update

Execute the bellow given command to install the build-required package.

sudo apt install build-essential

Now the GCC compiler is installed successfully. To check the GCC version issue the following command:

gcc --version

GCC version in output will different and depends when you installing. Output should look like this:

gcc (Debian 10.2.1-6) 10.2.1
Copyright (C) 2020 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.

Step 3 – Compile a sample Program#

It is very easy to compile C or C++ program using GCC. Let’s create and 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

You will get output as following:

Welcome GCC!

Conclusion#

You learned how to install GCC on your Debian 11 bullseye. 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 Git on Ubuntu 22.04
Next Article   How to Install CouchDB on Ubuntu 22.04

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 Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 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