{"id":2445,"date":"2025-02-24T15:26:50","date_gmt":"2025-02-24T15:26:50","guid":{"rendered":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?p=2445"},"modified":"2025-05-21T14:33:48","modified_gmt":"2025-05-21T14:33:48","slug":"install-gcc-compiler-on-windows","status":"publish","type":"post","link":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html","title":{"rendered":"How to Install GCC Compiler on Windows?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u27a2 <strong>Introduction<\/strong><\/h2>\n\n\n\n<p>This knowledge base is for those planning to install the GCC (GNU Compiler Collection) compiler on their Windows systems. Whether you are a programming beginner or an experienced developer, having GCC installed on your Windows system is crucial. It is an essential platform for compiling and running C, C++, and other language programs seamlessly.<\/p>\n\n\n\n<p>It is important to note that since GCC was originally designed for Unix-based systems, installing it on Windows requires some additional steps.<\/p>\n\n\n\n<p>This knowledge base will walk you through the step-by-step process of installing GCC on Windows using MinGW-w64 and other alternative methods.<\/p>\n\n\n\n<p>By the end of this blog, you will understand:<\/p>\n\n\n\n<ul class=\"wp-block-list\" style=\"list-style: ' \\27A2';\">\n\n<li>&nbsp;What is GCC Compiler?<\/li>\n\n\n<li>&nbsp;What are its Prerequisites?<\/li>\n\n\n<li>&nbsp;What are the Features of GCC Compiler?<\/li>\n\n\n<li>&nbsp;Steps to Install GCC Using MinGW-w64<\/li>\n\n\n<li>&nbsp;Installing GCC on Windows via Subsystem for Linux (WSL)<\/li>\n\n<\/ul>\n\n\n\n<p>Let&#8217;s dive in and set up a fully functional GCC Compiler on Windows that is ready for development.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u27a2 <strong>What is a GCC Compiler?<\/strong><\/h2>\n\n\n\n<p>GCC (GNU Compiler Collection) is a powerful tool for transforming human-readable code written in languages like C, C++, and Fortran into machine-readable instructions that a computer can understand and execute. It acts as a translator between the programmer and the computer.<\/p>\n\n\n\n<p><strong>Why is GCC Important?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It allows developers to compile and run their programs.<\/li>\n\n\n\n<li>It supports multiple programming languages.<\/li>\n\n\n\n<li>It is widely used in software development, operating systems, and embedded systems.<\/li>\n<\/ul>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/433\/locating-and-editing-host-file-in-windows.html\"><strong>A Guide To Locating &amp; Editing a Host File in Windows 10<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Example: Compiling a Simple C Program with GCC<\/strong><\/h3>\n\n\n\n<p>Let&#8217;s say you write a simple <strong>C program<\/strong> called <strong>hello.c<\/strong> that prints <strong>\u201cHello, World!\u201d<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Write the C Code<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>c<\/strong><br><br><strong>#include &lt;stdio.h&gt;<\/strong><br><br><strong>int main() {<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;printf(&#8220;Hello, World!\\n&#8221;);<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<\/strong><br><strong>}<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Compile the Code Using GCC<\/strong><\/h4>\n\n\n\n<p>\u2794 If you have GCC installed, open the command prompt and run:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>nginx<\/strong><br><br><strong>gcc hello.c -o hello.exe<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Here\u2019s what happens:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>gcc<\/strong> \u2192 Calls the GCC compiler.<\/li>\n\n\n\n<li><strong>hello.c<\/strong> \u2192 The source file to be compiled.<\/li>\n\n\n\n<li><strong>-o hello.exe<\/strong> \u2192 Specifies the output file name (<strong>hello.exe<\/strong>).<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: Run the Compiled Program<\/strong><\/h4>\n\n\n\n<p><strong>Input:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>hello.exe<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">Hello, World!<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This simple example shows how GCC compiles a human-written C program into an executable file that the computer can run.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/426\/telnet-command-in-windows.html\"><strong>What is Telnet Command in Windows &amp; How to Use it?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u27a2<\/strong> <strong>What are its Prerequisites?<\/strong><\/h2>\n\n\n\n<p>Before installing the GCC compiler on your Windows system, check a few things. Here are the prerequisites necessary for a smooth installation process and to help avoid errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. A Windows Operating System<\/strong><\/h3>\n\n\n\n<p>You need a Windows PC (Windows 10, 11, or earlier versions). The installation steps may differ slightly based on your version of Windows.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Administrator Access<\/strong><\/h3>\n\n\n\n<p>To install software, you may require administrator privileges. If you are using a personal computer, you likely have the necessary permissions. However, if you are on a work or school computer, you should obtain approval for admin access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. A Stable Internet Connection<\/strong><\/h3>\n\n\n\n<p>A reliable internet connection is necessary to download the GCC compiler and other essential tools (like MinGW-w64). The installer will retrieve files online, so ensure your connection is active.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. A Command Line Tool (Command Prompt or PowerShell)<\/strong><\/h3>\n\n\n\n<p>GCC is primarily used via the Command Prompt (cmd) or PowerShell in Windows. You should be comfortable using basic commands like:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">bash<br>cd directory_name<br>gcc &#8211;version<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>These commands assist in navigating files and verifying if GCC is installed correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. MinGW or an Alternative GCC Package<\/strong><\/h3>\n\n\n\n<p>Since Windows doesn&#8217;t have a built-in GCC compiler, you&#8217;ll need to install it manually. The most popular method is through MinGW-w64, which includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GCC (compiler)<\/li>\n\n\n\n<li>G++ (for C++ programs)<\/li>\n\n\n\n<li>Other necessary tools<\/li>\n<\/ul>\n\n\n\n<p><strong>Alternative Options:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Cygwin (a Linux-like environment for Windows).<\/li>\n\n\n\n<li>WSL (Windows Subsystem for Linux) if you prefer a Linux environment.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Setting Up Environment Variables (Optional but Recommended)<\/strong><\/h3>\n\n\n\n<p>To use GCC from any location in the command line, you might need to add it to the system\u2019s PATH. This step ensures that Windows recognizes GCC commands universally.<\/p>\n\n\n\n<p>Note: Once you have these prerequisites, you are ready to install GCC on Windows.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/424\/find-location-of-windows-log-files.html\"><strong>How Can You Find The Location of the Windows Log Files?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u27a2 <strong>Features of GCC Compiler<\/strong><\/h2>\n\n\n\n<p>The GCC (GNU Compiler Collection) is a powerful tool that converts human-readable programming code into machine-readable instructions. Developers widely use it for its flexibility, speed, and support for multiple languages. Here are some of its key features:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Supports Multiple Programming Languages<\/strong><\/h3>\n\n\n\n<p>GCC can compile programs written in different languages like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C<\/li>\n\n\n\n<li>C++<\/li>\n\n\n\n<li>Objective-C<\/li>\n\n\n\n<li>Fortran<\/li>\n\n\n\n<li>Ada<\/li>\n\n\n\n<li>Go<\/li>\n<\/ul>\n\n\n\n<p>That is why the GCC compiler is so versatile for various development needs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Cross-Platform Compatibility<\/strong><\/h3>\n\n\n\n<p>GCC works on different operating systems, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Windows (via MinGW-w64 or Cygwin)<\/li>\n\n\n\n<li>Linux<\/li>\n\n\n\n<li>MacOS<\/li>\n<\/ul>\n\n\n\n<p>This allows you to write code once and compile it on various systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Open-Source and Free<\/strong><\/h3>\n\n\n\n<p>GCC is entirely free and open-source, which signifies:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Anyone can download and use it without paying.<\/li>\n\n\n\n<li>Developers can modify and improve it.<\/li>\n<\/ul>\n\n\n\n<p>This makes it a popular choice in academia, open-source projects, and commercial development.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Optimized Code Compilation<\/strong><\/h3>\n\n\n\n<p>GCC improves the performance of programs by optimizing the compiled code.<\/p>\n\n\n\n<p><strong>It can:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reduce memory usage.<\/li>\n\n\n\n<li>Improve execution speed.<\/li>\n\n\n\n<li>Remove unnecessary parts of the code.<\/li>\n<\/ul>\n\n\n\n<p>This leads to quicker and more efficient programs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Supports Debugging and Error Detection<\/strong><\/h3>\n\n\n\n<p><hr><p>GCC offers detailed error messages to assist programmers in identifying and correcting mistakes in their code. It also supports debugging tools such as GDB (GNU Debugger) for troubleshooting programs.<\/p><hr><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Allows Cross-Compilation<\/strong><\/h3>\n\n\n\n<p>GCC can generate code for a system that is different from the one it is running on. For example, you can use GCC on Windows to compile a program that will run on Linux. This is useful for software development across multiple platforms.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. Supports Different Compilation Options<\/strong><\/h3>\n\n\n\n<p>GCC lets you customize the compilation process using flags and options. For example:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>-o<\/strong> \u2192 To specify an output file name<br><strong>-Wall<\/strong> \u2192 To show warnings<br><strong>-O2<\/strong> \u2192 To optimize the code for better performance<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>These options provide developers greater control over the compilation of their code.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/419\/fix-remote-desktop-stopped-working.html\"><strong>How to Fix Remote Desktop Connection Has Stopped Working?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<p><strong>*Important Note:<\/strong><\/p>\n\n\n\n<p>GCC is a powerful, free, and widely used compiler. It supports various programming languages, optimizes code, and offers excellent debugging tools. Due to these features, it remains a top choice for developers globally.<\/p>\n\n\n<hr>\n<p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/445\/windows-powershell-basic-commands.html\"><strong>Know Windows PowerShell Basic Commands<\/strong><\/a><\/p>\n<hr>\n\n\n<h2 class=\"wp-block-heading\">\u27a2 <strong>Steps to Install GCC Using MinGW-w64<\/strong><\/h2>\n\n\n\n<p>The easiest way to install the GCC compiler on Windows is to use MinGW-w64. Below is a step-by-step guide to help you install and set it up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Download MinGW-w64<\/strong><\/h3>\n\n\n\n<p>1. Open your web browser and go to the <strong>MinGW-w64<\/strong> official website:<br><a href=\"https:\/\/www.mingw-w64.org\/\">https:\/\/www.mingw-w64.org\/<\/a><\/p>\n\n\n\n<p>2. Click on the<strong> \u2018Downloads\u2019<\/strong> section.<\/p>\n\n\n\n<p>3. Select the latest version of MinGW-w64 for Windows.<\/p>\n\n\n\n<p>4. Choose the correct architecture (64-bit or 32-bit) based on your system.<\/p>\n\n\n\n<p>5. Download the installer (.exe file).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Install MinGW-w64<\/strong><\/h3>\n\n\n\n<p>1. Run the downloaded installer (<strong>mingw-w64-install.exe<\/strong>).<\/p>\n\n\n\n<p>2. Select the installation directory (e.g., <strong>C:\\mingw-w64\\<\/strong>).<\/p>\n\n\n\n<p>3. Choose the architecture (<strong>x86_64<\/strong> for 64-bit or <strong>i686<\/strong> for 32-bit).<\/p>\n\n\n\n<p>4. Keep all default settings and click <strong>\u2018Next\u2019<\/strong> to install.<\/p>\n\n\n\n<p>5. Wait for the installation to complete, then click <strong>\u2018Finish.\u2019<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Add MinGW-w64 to System PATH (Important!)<\/strong><\/h3>\n\n\n\n<p>To use GCC from the command line, you must add it to the <strong>system PATH<\/strong>.<\/p>\n\n\n\n<p>1. Open the<strong> \u2018Start Menu\u2019<\/strong> and search for <strong>\u2018Environment Variables.\u2019<\/strong><\/p>\n\n\n\n<p>2. Click on <strong>\u2018Edit the system environment variables.\u2019<\/strong><\/p>\n\n\n\n<p>3. In the <strong>\u2018System Properties\u2019<\/strong> window, click on <strong>\u2018Environment Variables.\u2019<\/strong><\/p>\n\n\n\n<p>4. Under <strong>\u2018System Variables\u2019<\/strong>, find and select <strong>\u2018Path\u2019<\/strong>, then click <strong>\u2018Edit.\u2019<\/strong><\/p>\n\n\n\n<p>5. Click <strong>\u2018New\u2019<\/strong> and add the following path (assuming you installed it in <strong>C:\\mingw-w64\\<\/strong>):<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>makefile<br><br>C:\\mingw-w64\\bin<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>6. Click <strong>\u2018OK\u2019<\/strong> to save and close all windows.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Verify the Installation<\/strong><\/h3>\n\n\n\n<p>1. Open <strong>\u2018Command Prompt (cmd).\u2019<\/strong><\/p>\n\n\n\n<p>2. Type the following command and press <strong>\u2018Enter\u2019<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">css<br><br>gcc &#8211;version<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>3. If the installation is successful, you should see the <strong>\u2018GCC version information\u2019<\/strong> displayed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Compile a Test Program (Optional Step)<\/strong><\/h3>\n\n\n\n<p>To check if GCC is working properly, create a simple <strong>\u2018C program\u2019<\/strong>:<\/p>\n\n\n\n<p>1. Open <strong>\u2018Notepad\u2019<\/strong> and type this code:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>c<br><br>#include &lt;stdio.h&gt;<\/strong><br><br><strong>int main() {<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;printf(&#8220;Hello, GCC!\\n&#8221;);<\/strong><br><strong>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<\/strong><br><strong>}<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>2. Save it as <strong>\u2018test.c\u2019<\/strong> (select <strong>All Files<\/strong> while saving).<\/p>\n\n\n\n<p>3. Open <strong>\u2018Command Prompt\u2019<\/strong> and navigate to the file location using:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>pgsql<br><br><\/strong><br><strong>cd path\\to\\file<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>4. Compile the program using:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>nginx<br><br>gcc test.c -o test.exe<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>5. Run the compiled program:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>test.exe<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>6. You should see the output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>Hello, GCC!<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>*Important Note:<\/strong><\/p>\n\n\n\n<p>Congratulations! You have successfully installed GCC on Windows using MinGW-w64. Now, you can begin compiling and running C\/C++ programs directly from your system.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/416\/how-to-install-mysql-server-in-windows.html\"><strong>How to Install MySQL Server in Windows?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installing GCC on Windows via Subsystem for Linux (WSL)<\/strong><\/h2>\n\n\n\n<p>If you prefer a Linux-like environment on Windows, the best way to install GCC is through Windows Subsystem for Linux (WSL). This method allows you to run Linux commands directly on Windows and install GCC just like you would on a real Linux system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Enable WSL on Windows<\/strong><\/h3>\n\n\n\n<p>1. <strong>Open PowerShell as Administrator<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click on <strong>\u2018Start\u2019<\/strong>, search for <strong>\u2018PowerShell\u2019<\/strong>, and select <strong>\u2018Run as Administrator.\u2019<\/strong><\/li>\n<\/ul>\n\n\n\n<p>2. <strong>Enable WSL by running this command:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>powershell<br><br>wsl &#8211;install<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This installs <strong>WSL<\/strong> and the default Linux distribution (Ubuntu).<\/p>\n\n\n\n<p>3. Restart your computer once the installation is complete.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Open WSL and Set Up Ubuntu<\/strong><\/h3>\n\n\n\n<p>1. After restarting, open <strong>Command Prompt (cmd)<\/strong> and type:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>nginx<br><br>wsl<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u2794 This will launch <strong>Ubuntu<\/strong> (or another installed Linux distribution).<\/p>\n\n\n\n<p>2. Set up your Linux user by creating a username and password when prompted.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Update the Package List<\/strong><\/h3>\n\n\n\n<p>Before installing GCC, update your Linux packages by running:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">bash<br><br>sudo apt update &amp;&amp; sudo apt upgrade -y<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>This ensures you get the latest software versions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Install GCC Compiler<\/strong><\/h3>\n\n\n\n<p>1. Run the following command to install <strong>GCC and G++ (for C++)<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>bash<br><br>sudo apt install gcc g++ -y<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Wait for the installation to complete.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 5: Verify the Installation<\/strong><\/h3>\n\n\n\n<p>1.Check if GCC is installed by running:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>bash<br><br>gcc &#8211;version<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You should see the installed <strong>GCC version<\/strong> displayed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 6: Compile and Run a Test Program (Optional)<\/strong><\/h3>\n\n\n\n<p>To check if GCC is working, create a simple <strong>C program<\/strong>:<\/p>\n\n\n\n<p>1Open Ubuntu (WSL) and create a new file:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>bash<br><br>nano test.c<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u2794 Type this sample code:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">c<br><br>#include &lt;stdio.h&gt;<br><br>int main() {<br>&nbsp;&nbsp;&nbsp;&nbsp;printf(&#8220;Hello, WSL!\\n&#8221;);<br>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>2. Save the file (Ctrl + X \u2192 Y \u2192 Enter).<\/p>\n\n\n\n<p>3. Compile the program:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\">bash<br><br>gcc test.c -o test<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>4. Run the compiled program:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>bash<br><br>.\/test<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>5. You should see the output:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"kb_firewall\"><strong>Hello, WSL!<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>*Important Note:<\/strong><\/p>\n\n\n\n<p>You have successfully installed <strong>GCC on Windows using<\/strong> <strong>WSL<\/strong>. Now, you can enjoy a <strong>Linux-like development environment<\/strong> on Windows without a virtual machine.<\/p>\n\n\n\n<p><hr><p><strong>Also Read: <\/strong><a href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/415\/how-to-launch-windows-iis-manager.html\"><strong>How to Launch Windows Internet Information (IIS) Manager?<\/strong><\/a><\/p><hr><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Installing the GCC compiler on Windows may seem daunting at first, but with the right approach, it becomes a simple process. Whether you opt for MinGW-w64 for a native Windows installation or WSL (Windows Subsystem for Linux) for a more Linux-like experience, you have the tools to compile and run your C\/C++ programs efficiently.<\/p>\n\n\n\n<p>By adhering to the provided step-by-step guides, you\u2019ve successfully:<\/p>\n\n\n\n<p>\u2713 Installed GCC using MinGW-w64 or WSL<\/p>\n\n\n\n<p>\u2713&nbsp;Configured your system for smooth operation<\/p>\n\n\n\n<p>\u2713 Compiled and executed a test program<\/p>\n\n\n\n<p>With GCC now established, you can immerse yourself in coding, debugging, and project building without limits. Whether you&#8217;re a beginner learning programming or an experienced developer working on advanced applications, GCC on Windows offers the flexibility and performance essential for software development.<\/p>\n\n\n\n<p>So, what\u2019s next? Begin writing your first C or C++ program, explore advanced compilation options, or even contribute to open-source projects! The possibilities are endless.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>Get Started with GCC Installation on Windows Today!<\/strong><\/p>\n\n\n    <div class=\"blg-advrt-main blg-prm-bx\">\n        <div class=\"row\" style=\"display: flex; justify-content: space-evenly; align-items: center;\">\n            <div class=\"col-md-5\">\n                <div class=\"blg-advrt-first blg-advrt-right\">\n                    <img decoding=\"async\" src=\"https:\/\/www.hostitsmart.com\/assets\/images\/blog\/Worried-about-website.png\" alt=\"Worried-about-website\" \/>\n                <\/div>\n            <\/div>\n            <div class=\"col-md-7\">\n                <div class=\"blg-advrt-first blg-advrt-left\">\n                    <div class=\"blg_advrt_cnt\">\n                        You Need Highly Secured Servers                    <\/div>\n                    <p>\n                        Get top-notch Windows VPS servers with Robust security                    <\/p>\n                    <div class=\"blg-advrt-first-btn affl-blg-btn\">\n                        <a href=\"https:\/\/www.hostitsmart.com\/servers\/windows-vps-hosting\">\n                            Go For Windows VPS                        <\/a>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n    ","protected":false},"excerpt":{"rendered":"<p>\u27a2 Introduction This knowledge base is for those planning to install the GCC (GNU Compiler Collection) compiler on their Windows systems. Whether you are a programming beginner or an experienced developer, having GCC installed on your Windows system is crucial. It is an essential platform for compiling and running C, C++, and other language programs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-2445","post","type-post","status-publish","format-standard","hentry","category-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install GCC Compiler on Windows?<\/title>\n<meta name=\"description\" content=\"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html\" \/>\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 Windows?\" \/>\n<meta property=\"og:description\" content=\"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html\" \/>\n<meta property=\"og:site_name\" content=\"Host IT Smart Knowledge base\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-24T15:26:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-21T14:33:48+00:00\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html\",\"name\":\"How to Install GCC Compiler on Windows?\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\"},\"datePublished\":\"2025-02-24T15:26:50+00:00\",\"dateModified\":\"2025-05-21T14:33:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\"},\"description\":\"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website\",\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\",\"name\":\"Host IT Smart Knowledge base\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g\",\"caption\":\"Admin\"},\"sameAs\":[\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/\"],\"url\":\"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install GCC Compiler on Windows?","description":"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.","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:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html","og_locale":"en_US","og_type":"article","og_title":"How to Install GCC Compiler on Windows?","og_description":"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.","og_url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html","og_site_name":"Host IT Smart Knowledge base","article_published_time":"2025-02-24T15:26:50+00:00","article_modified_time":"2025-05-21T14:33:48+00:00","author":"Admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Admin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html","name":"How to Install GCC Compiler on Windows?","isPartOf":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website"},"datePublished":"2025-02-24T15:26:50+00:00","dateModified":"2025-05-21T14:33:48+00:00","author":{"@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108"},"description":"Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/435\/install-gcc-compiler-on-windows.html"]}]},{"@type":"WebSite","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#website","url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/","name":"Host IT Smart Knowledge base","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/317c14a877385667f19d3b7496bd5108","name":"Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d4827c56a6721070dde339640d47ff44ba0d0e515c7e577cf29305ab72383fe3?s=96&d=mm&r=g","caption":"Admin"},"sameAs":["https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/"],"url":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/2445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2445"}],"version-history":[{"count":20,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/2445\/revisions"}],"predecessor-version":[{"id":3052,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/posts\/2445\/revisions\/3052"}],"wp:attachment":[{"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostitsmart.com\/manage\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}