How to Download and Install GCC Compiler in C for Windows PC

In this tutorial, we will learn how to install GCC in Windows 10, Mac, and Linux.

How to Install GCC on Windows

We will use an open-source Integrated Development environment named Code::Blocks which bundles a compiler (named gcc offered by Free Software Foundation GNU), editor and debugger in a neat package.

Step 1) Download Binary release

Go to http://www.codeblocks.org/downloads and click Binary Release.

Install GCC on Windows

Step 2) Select the installer with GCC for Windows compiler

Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW’s GNU GCC compiler download and GNU GDB debugger with Code::Blocks source files.

Install GCC on Windows

Step 3) Start installation

Run the downloaded installer and accept the default options for installing GCC Windows. This straightforward process ensures a seamless setup of the GCC compiler on your Windows system.

Install GCC on Windows

Step 4) Accept the terms and conditions

Accept the Agreement

Install GCC on Windows

Step 5) Keep default component selection

Keep the component selection default and click Next.

Install GCC on Windows

Step 6) Locate the installation path

You may change the installation folder and click Next.

Install GCC on Windows

Step 7) Find and double-click on the CodeBlocks icon

To launch Code::Blocks double click on the icon.

Install GCC on Windows

Step 8) Let it detect the compiler itself

It will detect the GCC compiler for Windows automatically, set it as default.

Install GCC on Windows

Associate C/C++ files with code::blocks

Step 9) Open the IDE and start using

You will see the IDE Home screen.

Install GCC on Windows

Install GCC Linux

Linux operating systems mostly comes with GCC preinstalled. To verify if the compiler is installed on the machine, run the following command in the terminal:

gcc --version

After executing this command if the gcc is installed on the machine then it will return the information about the compiler otherwise it will ask you to install the compiler.

To set up the ‘C’ environment on Linux distributions follow the given steps:

1. Open terminal.

2. For red-hat, Fedora users, type and execute this command

# yum groupinstall 'Development Tools'

3. For Debian and Ubuntu users, type and execute following command

$ sudo apt-get update
$ sudo apt-get install build-essential manpages-dev

4. To verify that the GCC has been successfully installed on the machine as we discussed earlier, execute the following command

gcc --version

Install GCC on Mac

To set up a ‘C’ programming environment on MAC operating system, follow the given steps:

1. Visit the given link https://developer.apple.com/downloads/index.action for install gcc on Windows. You will need an Apple developer ID

“Command Line Tools for X-Code,” pick any version (latest version is always recommended) and download the .dmg file.

2. After the file is being downloaded on the machine, double click and follow the wizard and install the file. Always keep the default settings as suggested by the installation wizard.

3. After the installation process, open a terminal and run gcc -v command to check if everything is successfully installed.

Conclusion

C‘ program can be written and executed on any machine that has a suitable environment to run the program. Its recommended using an IDE or C compiler for Windows to run C programs. An IDE includes a compiler, editor and debugger. Clanfg, MinGW compiler (Minimalist GNU compiler collection for Windows), Portable ‘C’ compiler, Turbo C are popular compilers available.