{"id":14679,"date":"2025-07-07T10:00:03","date_gmt":"2025-07-07T10:00:03","guid":{"rendered":"https:\/\/greenwebpage.com\/community\/?p=14679"},"modified":"2025-07-07T10:00:06","modified_gmt":"2025-07-07T10:00:06","slug":"how-to-install-gcc-compiler-on-debian-12","status":"publish","type":"post","link":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/","title":{"rendered":"How to Install GCC Compiler on Debian 12"},"content":{"rendered":"\n<p>GCC stands for GNU Compiler Collection, which is a highly optimizing and extensive compilation suite. It offers packages for many programming languages, including C++, C, Ada, Fortran, Objective-C, and Go. The GCC compiler in Debian 12 is very important for developers and programmers who work in the Linux operating system.<\/p>\n\n\n\n<p>The GCC installed in Debian 12 is capable of compiling software from source. This is vital for programmers needing their code to be transformed into a binary program or an application. It is used for making a library out of the code they have written, as well as when repurposing code found in the wild.<\/p>\n\n\n\n<p>In this article, we will describe how you can install the GCC compiler on your Debian 12.<\/p>\n\n\n\n<p><strong>Table of Contents<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#How-to-Install-GCC-Compiler-on-Debian-12\">How to Install GCC Compiler on Debian 12?<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#Method-1:-Installing-GCC-Compiler-on-Debian-12-Using-APT-Package-Manager\">Method 1: Using APT Package Manager<\/a><\/li>\n\n\n\n<li><a href=\"#Method-2:-Installing-GCC-Compiler-on-Debian-12-Using-Source-Code\">Method 2: Using Source Code<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#How-to-Run-a-C-or-C++-Program-Using-the-GCC-Compiler\">How to Run a C or C++ Program using the GCC Compiler?<\/a><\/li>\n\n\n\n<li><a href=\"#Conclusion\">Conclusion <\/a><\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s start the article with installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"How-to-Install-GCC-Compiler-on-Debian-12\"><a id=\"post-14679-_91fxt1a7y43n\"><\/a>How to Install GCC Compiler on Debian 12?<\/h2>\n\n\n\n<p>GCC compilers provide the ability for users to build and install open source software, such as the Linux operating system distribution, from source without needing to install any software in advance. For installation, update the package lists of your computer and then install the GCC package with\u201csudo apt install build-essential\u201d.<\/p>\n\n\n\n<p>Here&#8217;s how you can install the GCC compiler on Debian 12:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Method-1:-Installing-GCC-Compiler-on-Debian-12-Using-APT-Package-Manager\"><a id=\"post-14679-_guy5nrx1ukl7\"><\/a>Method 1: Installing GCC Compiler on Debian 12 Using APT Package Manager<\/h3>\n\n\n\n<p>With GCC, however, they can ensure that they are compatible with the system libraries. Using the APT package manager, the installation of the GCC Compiler on Debian 20.04 becomes easy. Let&#8217;s follow the steps below:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_gtgf16uwgn2r\"><\/a>Step 1: Updating Package list<\/h4>\n\n\n\n<p>First, refresh the package index and upgrade the system by issuing the following apt command:<\/p>\n\n\n\n<pre>sudo apt update<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1147\" height=\"372\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-1.png\" alt=\"sudo apt update\" class=\"wp-image-14680\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-1.png 1147w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-1-300x97.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-1-1024x332.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-1-768x249.png 768w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_g66ux0i17cu7\"><\/a>Step 2: Install GCC Package<\/h4>\n\n\n\n<p>Once it is done, install the GCC package with the use of the \u201cbuild-essential\u201d tool:<\/p>\n\n\n\n<pre>sudo apt install build-essential<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1152\" height=\"271\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-2.png\" alt=\"sudo apt install build-essential\" class=\"wp-image-14681\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-2.png 1152w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-2-300x71.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-2-1024x241.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-2-768x181.png 768w\" sizes=\"(max-width: 1152px) 100vw, 1152px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>It installs the GCC compiler and other utilities like \u201cmake\u201d, and \u201cg++\u201d.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_26n3ucxx6np5\"><\/a>Step 3: Check GCC Version<\/h4>\n\n\n\n<p>Now users can even check the installation of GCC by checking its version:<\/p>\n\n\n\n<pre>gcc --version<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1148\" height=\"268\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-3.png\" alt=\"gcc --version\" class=\"wp-image-14682\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-3.png 1148w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-3-300x70.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-3-1024x239.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-3-768x179.png 768w\" sizes=\"(max-width: 1148px) 100vw, 1148px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_jdes0y5j0n4\"><\/a>Remove\/Uninstall GCC Compiler<\/h4>\n\n\n\n<p>To uninstall\/remove GCC Compiler\u200b\u200b on Debian \u200b12, use the \u201cautoremove\u201d option with \u201cbuild-essential\u201d packages as shown below:<\/p>\n\n\n\n<pre>sudo apt autoremove build-essential<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1151\" height=\"532\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-4.png\" alt=\"sudo apt autoremove build-essential\" class=\"wp-image-14683\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-4.png 1151w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-4-300x139.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-4-1024x473.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-4-768x355.png 768w\" sizes=\"(max-width: 1151px) 100vw, 1151px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>This is how you install the GCC compiler on Debian 12.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Method-2:-Installing-GCC-Compiler-on-Debian-12-Using-Source-Code\"><a id=\"post-14679-_e4e9d6x20t46\"><\/a>Method 2: Installing GCC Compiler on Debian 12 Using Source Code<\/h3>\n\n\n\n<p>The installation of GCC compilers on Debian 12 provides a foundation that enables users to develop, customize, and learn software, creating a space where code can be turned into viable and effective software tools.<\/p>\n\n\n\n<p>To install GCC Compiler on Debian 12 From Source Code, use the following steps:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_mcqqkcne9zwx\"><\/a>Step 1: Updating the Packages List<\/h4>\n\n\n\n<p>Start by making sure your system software is up to date. (Package installation required for the system):<\/p>\n\n\n\n<pre>sudo apt update<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1147\" height=\"372\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-5.png\" alt=\"sudo apt update\" class=\"wp-image-14684\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-5.png 1147w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-5-300x97.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-5-1024x332.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-5-768x249.png 768w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_qoj17y34o9b1\"><\/a>Step 2: Install Necessary Dependencies<\/h4>\n\n\n\n<p>Then, install the dependencies, along with the \u201cbuild-essential\u201d tool to build the code if there are any problems.<\/p>\n\n\n\n<pre>sudo apt install build-essential<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1152\" height=\"271\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-6.png\" alt=\"sudo apt install build-essential\" class=\"wp-image-14685\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-6.png 1152w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-6-300x71.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-6-1024x241.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-6-768x181.png 768w\" sizes=\"(max-width: 1152px) 100vw, 1152px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_v2547l5xvju4\"><\/a>Step 3: Download the GCC Source Code<\/h4>\n\n\n\n<p>Then, download the GCC source from the <a href=\"https:\/\/ftp.gnu.org\/gnu\/gcc\">official GNU website<\/a> using the \u201cwget\u201d (HTTP client) tool:<\/p>\n\n\n\n<pre>wget https:\/\/ftp.gnu.org\/gnu\/gcc\/gcc-13.2.0\/gcc-13.2.0.tar.gz<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1146\" height=\"383\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-7.png\" alt=\"wget https:\/\/ftp.gnu.org\/gnu\/gcc\/gcc-13.2.0\/gcc-13.2.0.tar.gz\" class=\"wp-image-14686\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-7.png 1146w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-7-300x100.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-7-1024x342.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-7-768x257.png 768w\" sizes=\"(max-width: 1146px) 100vw, 1146px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_kcxsdxyh4vio\"><\/a>Step 4: Extract the Downloaded File<\/h4>\n\n\n\n<p>So now you can uncompress the downloaded file with the \u201ctar\u201d command using the \u201cxvf\u201d option:<\/p>\n\n\n\n<pre>tar -xvf gcc-13.2.0.tar.gz<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1145\" height=\"365\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-8.png\" alt=\"tar -xvf gcc-13.2.0.tar.gz\" class=\"wp-image-14687\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-8.png 1145w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-8-300x96.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-8-1024x326.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-8-768x245.png 768w\" sizes=\"(max-width: 1145px) 100vw, 1145px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_asz4is9bipfx\"><\/a>Step 5: Configure Build Environment<\/h4>\n\n\n\n<p>Then, go to that extracted directory with the \u201ccd\u201d command, set up your build environment configure the\u201d command as below:<\/p>\n\n\n\n<pre>cd gcc-13.2.0<\/pre>\n<pre>..\/gcc-13.2.0\/configure --prefix=$HOME\/gcc-13.2.0-install --disable-multilib --enable-languages=c,c++<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1145\" height=\"565\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-9.png\" alt=\"..\/gcc-13.2.0\/configure --prefix=$HOME\/gcc-13.2.0-install --disable-multilib --enable-languages=c,c++\" class=\"wp-image-14688\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-9.png 1145w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-9-300x148.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-9-1024x505.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-9-768x379.png 768w\" sizes=\"(max-width: 1145px) 100vw, 1145px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>If users get an error about dependencies, install these tools to fix it:<\/p>\n\n\n\n<pre>.\/contrib\/download_prerequisites<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1142\" height=\"527\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-10.png\" alt=\".\/contrib\/download_prerequisites\" class=\"wp-image-14689\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-10.png 1142w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-10-300x138.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-10-1024x473.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-10-768x354.png 768w\" sizes=\"(max-width: 1142px) 100vw, 1142px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_dwrtd2r29leu\"><\/a>Step 6: Compile Source Code<\/h4>\n\n\n\n<p>Users will have built the environment and then can compile the source code using the command \u201cmake\u201d :<\/p>\n\n\n\n<pre>make -j$(nproc)<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1144\" height=\"497\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-11.png\" alt=\"make -j$(nproc)\" class=\"wp-image-14690\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-11.png 1144w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-11-300x130.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-11-1024x445.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-11-768x334.png 768w\" sizes=\"(max-width: 1144px) 100vw, 1144px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_1ea21xlartor\"><\/a>Step 7: Install GCC<\/h4>\n\n\n\n<p>At last, install GCC and required packages using the \u201cinstall\u201d tool as follows:<\/p>\n\n\n\n<pre>make install<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1151\" height=\"266\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-12.png\" alt=\"make install\" class=\"wp-image-14691\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-12.png 1151w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-12-300x69.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-12-1024x237.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-12-768x177.png 768w\" sizes=\"(max-width: 1151px) 100vw, 1151px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><a id=\"post-14679-_3yi3iglrkfp\"><\/a>Step 8: Verify GCC Installation<\/h4>\n\n\n\n<p>To verify, users can verify the GCC version using the path below:<\/p>\n\n\n\n<pre>\/usr\/local\/gcc-13.2.0\/bin\/gcc-13.2.0 --version<\/pre>\n\n\n\n<p>This is all about how to install the GCC Compiler on Debian 12 from the source code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"How-to-Run-a-C-or-C++-Program-Using-the-GCC-Compiler\"><a id=\"post-14679-_ndc652t9u9j5\"><\/a>How to Run a C or C++ Program Using the GCC Compiler?<\/h2>\n\n\n\n<p>Understanding how to compile code in the software development process and how programs behave on a Unix-like operating system like Debian is a solid foundation.<\/p>\n\n\n\n<p>Here is how to write and compile a simple C or C++ program using the GCC compiler in Debian 12:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14679-_7sulzwiso55o\"><\/a>Step 1: Install the Build-Essential Package<\/h3>\n\n\n\n<p>First, you have to install this package, which includes the GCC compiler and other tools:<\/p>\n\n\n\n<pre>sudo apt install build-essential<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14679-_oub87rjmvrmv\"><\/a>Step 2: Create a C Program File<\/h3>\n\n\n\n<p>For example, to make a file called &#8220;linux_file.c\u201d, and then enter a text editor, you can use \u201cnano\u201d (the user may give it any name to your program):<\/p>\n\n\n\n<pre>nano linux_file.c<\/pre>\n\n\n\n<p>To print the message, type the following in the editor in C source code:<\/p>\n\n\n\n<pre>#include &lt;stdio.h&gt; <br>int main() { <br>printf(\"Linux has Debian 12 distribution\"); <br>return 0; <br>}<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1151\" height=\"538\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-13.png\" alt=\"#include &lt;stdio.h&gt; <br&gt;int main() { <br&gt;printf(&quot;Linux has Debian 12 distribution&quot;); <br&gt;return 0; <br&gt;}\" class=\"wp-image-14692\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-13.png 1151w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-13-300x140.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-13-1024x479.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-13-768x359.png 768w\" sizes=\"(max-width: 1151px) 100vw, 1151px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Now, save the file and close the text editor, then go back to the terminal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14679-_8lqxtopj4zut\"><\/a>Step 3: Compile a C Program<\/h3>\n\n\n\n<p>Now you should use the \u201ccd\u201d command to browse through the folder where the C or C++ has been saved. To build a program, you use the \u201cgcc\u201d command. It will make a binary called \u201cdebia12\u201d<\/p>\n\n\n\n<pre>gcc -o debian12 linux_file.c<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1148\" height=\"95\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-14.png\" alt=\"gcc -o debian12 linux_file.c\" class=\"wp-image-14693\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-14.png 1148w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-14-300x25.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-14-1024x85.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-14-768x64.png 768w\" sizes=\"(max-width: 1148px) 100vw, 1148px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>In this case, debian12 is the name that you want to call your compiled program, whereas \u201clinux_file.c\u201d is the source file:<\/p>\n\n\n\n<p>For a C++ program, use g++ along with the source file name with a .cpp extension:<\/p>\n\n\n\n<pre>g++ -o output_name source_file.cpp<\/pre>\n\n\n\n<p>Note: Don\u2019t forget to replace \u201coutput_name\u201d and \u2018source_file\u2019 with your program\u2019s name and file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14679-_ycquok9375ez\"><\/a>Step 4: Run the Compiled Program<\/h3>\n\n\n\n<p>Last of all, users launch the program \u2018genie\u2019 in the following manner:<\/p>\n\n\n\n<pre>.\/debian12<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1141\" height=\"135\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-15.png\" alt=\".\/debian12\" class=\"wp-image-14694\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-15.png 1141w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-15-300x35.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-15-1024x121.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/word-image-14679-15-768x91.png 768w\" sizes=\"(max-width: 1141px) 100vw, 1141px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>That&#8217;s all for a simple C++ program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Conclusion\"><a id=\"post-14679-_og5r5997mu3s\"><\/a>Conclusion<\/h2>\n\n\n\n<p>For Debian 12 to install the GCC Compiler, first update the package lists and install the package using the command \u201csudo apt install build-essential\u201d. It doesn\u2019t just install the GCC, but also includes other programs that are part of it, like \u201cg++\u201d and \u201cmake\u201d. Or users can also install GCC on Debian with the source code.<\/p>\n\n\n\n<p>If you want to compile the C++ program with the \u201cgcc -o output_name source_file.c\u201d command. Here \u201coutput_name\u201d is the name you want to store your compiled program with and \u201csource_file. c\u201d is your source file.<\/p>\n\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>GCC stands for GNU Compiler Collection, which is a highly optimizing and extensive compilation suite. It offers packages for many programming languages, including C++, C, Ada, Fortran, Objective-C, and Go. The GCC compiler in Debian 12 is very important for developers and programmers who work in the Linux operating system. The GCC installed in Debian [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":14701,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[875,297,874,341],"class_list":["post-14679","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-c","tag-debian-12","tag-gcc","tag-gcc-compiler"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install GCC Compiler on Debian 12 - Greenwebpage Community<\/title>\n<meta name=\"description\" content=\"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install GCC Compiler on Debian 12 - Greenwebpage Community\" \/>\n<meta property=\"og:description\" content=\"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\" \/>\n<meta property=\"og:site_name\" content=\"Greenwebpage Community\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-07T10:00:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-07T10:00:06+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karim Buzdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karim Buzdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\"},\"author\":{\"name\":\"Karim Buzdar\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\"},\"headline\":\"How to Install GCC Compiler on Debian 12\",\"datePublished\":\"2025-07-07T10:00:03+00:00\",\"dateModified\":\"2025-07-07T10:00:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\"},\"wordCount\":986,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg\",\"keywords\":[\"C++\",\"Debian 12\",\"gcc\",\"GCC Compiler\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\",\"name\":\"How to Install GCC Compiler on Debian 12 - Greenwebpage Community\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg\",\"datePublished\":\"2025-07-07T10:00:03+00:00\",\"dateModified\":\"2025-07-07T10:00:06+00:00\",\"description\":\"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!\",\"breadcrumb\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg\",\"width\":1020,\"height\":600,\"caption\":\"How to install gcc on Debian 12\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/greenwebpage.com\/community\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install GCC Compiler on Debian 12\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"name\":\"Greenwebpage Community\",\"description\":\"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.\",\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/greenwebpage.com\/community\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\",\"name\":\"Greenwebpage Community\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"width\":512,\"height\":512,\"caption\":\"Greenwebpage Community\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\",\"name\":\"Karim Buzdar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"caption\":\"Karim Buzdar\"},\"sameAs\":[\"https:\/\/greenwebpage.com\"],\"url\":\"https:\/\/greenwebpage.com\/community\/author\/karim\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install GCC Compiler on Debian 12 - Greenwebpage Community","description":"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/","og_locale":"en_US","og_type":"article","og_title":"How to Install GCC Compiler on Debian 12 - Greenwebpage Community","og_description":"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!","og_url":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/","og_site_name":"Greenwebpage Community","article_published_time":"2025-07-07T10:00:03+00:00","article_modified_time":"2025-07-07T10:00:06+00:00","og_image":[{"width":1020,"height":600,"url":"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg","type":"image\/jpeg"}],"author":"Karim Buzdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Karim Buzdar","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#article","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/"},"author":{"name":"Karim Buzdar","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8"},"headline":"How to Install GCC Compiler on Debian 12","datePublished":"2025-07-07T10:00:03+00:00","dateModified":"2025-07-07T10:00:06+00:00","mainEntityOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/"},"wordCount":986,"commentCount":0,"publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg","keywords":["C++","Debian 12","gcc","GCC Compiler"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/","url":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/","name":"How to Install GCC Compiler on Debian 12 - Greenwebpage Community","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/#website"},"primaryImageOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg","datePublished":"2025-07-07T10:00:03+00:00","dateModified":"2025-07-07T10:00:06+00:00","description":"In this article, we will describe how you can install the GCC compiler on your Debian 12 server. Learn more!","breadcrumb":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#primaryimage","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/07\/How-to-install-gcc-on-Debian-12-1.jpg","width":1020,"height":600,"caption":"How to install gcc on Debian 12"},{"@type":"BreadcrumbList","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-gcc-compiler-on-debian-12\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/greenwebpage.com\/community\/"},{"@type":"ListItem","position":2,"name":"How to Install GCC Compiler on Debian 12"}]},{"@type":"WebSite","@id":"https:\/\/greenwebpage.com\/community\/#website","url":"https:\/\/greenwebpage.com\/community\/","name":"Greenwebpage Community","description":"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.","publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/greenwebpage.com\/community\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/greenwebpage.com\/community\/#organization","name":"Greenwebpage Community","url":"https:\/\/greenwebpage.com\/community\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","width":512,"height":512,"caption":"Greenwebpage Community"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8","name":"Karim Buzdar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","caption":"Karim Buzdar"},"sameAs":["https:\/\/greenwebpage.com"],"url":"https:\/\/greenwebpage.com\/community\/author\/karim\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/comments?post=14679"}],"version-history":[{"count":4,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14679\/revisions"}],"predecessor-version":[{"id":14698,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14679\/revisions\/14698"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media\/14701"}],"wp:attachment":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media?parent=14679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/categories?post=14679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/tags?post=14679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}