Wind Layer Blog

How to Install C/GCC Compiler for Windows

The first and most important step for anyone interested in learning C programming on Windows is to set up a suitable development environment. Installing a C compiler is the fundamental step in this setup, and GCC (GNU Compiler Collection) is one of the most widely used options due to its reliability and popularity.

The GNU Compiler Collection (GCC) is a collection of compilers that can be used run code written in a variety of languages, including C++, C, Fortran, and many more. The GNU Project created this open-source program, which can run on many different operating systems and platforms, such as Windows, iOS, Linux, PowerPC, and ARM-based embedded computers. Many error checking and debugging facilities are available in the GCC Compiler, which can save a great deal of time and effort.

Since GCC is cross-platform and supports a variety of operating systems and architectures, it is now commonly utilized by developers to create embedded systems and Internet of Things devices.

Together, we can take this journey to enhance your programming efforts and create a smooth path for Windows C development.

To install the C/GCC compiler (GNU Compiler Collection) on Windows, you can use MinGW (Minimalist GNU for Windows) or MSYS2 (Minimal System 2). Here are the steps for both methods:

Installing C/GCC Compiler on Windows using MSYS2

MinGW (Minimalist GNU for Windows) offers a number of publicly available and freely distributable Windows-specific header files and import libraries

Below are the steps for using MinGW:

1) Download MinGW

Visit the MinGW website (https://osdn.net/projects/mingw/) to download the most recent MinGW Installation Manager version `mingw-get-setup.exe`.

2) Run the Installer

Run the installer `mingw-get-setup.exe` after downloading it.

3) Components selection

To install certain components, you’ll need to choose them in the installation manager. Make sure you have at least selected the C and C++ compilers from the `mingw32-base` and `mingw32-gcc-g++` packages.

4) Install

Click “Install” or “Apply Changes” to continue with the installation.

5) Set Environment Variables (Optional)

Consider setting your system PATH environment variable to include the MinGW `bin` location after installation. This directory is typically found in `C:\MinGW\bin` by default.

6) Installation verification

Ensure that GCC has been installed correctly. Open the command prompt and type ` gcc –version`. After a successful installation, you should see the GCC version information.

Installing C/GCC Compiler on Windows using MinGW

MSYS2 (Minimal System 2) offers a powerful solution by providing a Unix-like environment for Windows, complete with a package manager to install essential development tools.

Below are the steps for using MSYS2:

1) Download MSYS2

Visit (https://www.msys2.org/) and download the installer that is compatible with the architecture of your system (64-bit or 32-bit)

2) Run the installer

After the download is finished, run the installer to begin the installation process `msys2-x86_64.exe` for 64-bit or `msys2-i686.exe` for 32-bit).

3) Install MSYS2
Complete the installation by following the instructions provided by the installer on the screen.

4) Update package database
After installation, update the package database by running the following command on MSYS shell from the Start menu:

				
					pacman -Syu
				
			


5) Install GCC

After the system has been updated, run the following command to install the GCC compiler:

For 64 Bit:

				
					pacman -S mingw-w64-x86_64-toolchain
				
			


For 32 Bit:

				
					pacman -S mingw-w64-i686-toolchain
				
			


6) Set Environment Variables (Optional)

Consider setting your system PATH environment variable to include the MSYS2 `bin` location after installation. The default installation path is typically `C:\msys64\usr\bin` for 64-bit and `C:\msys32\usr\bin` for 32-bit.

7) Installation verification

Ensure that GCC has been installed correctly. Open the command prompt and type ` gcc –version`. You should see the version information of GCC displayed, indicating a successful installation.

Share the Post:

Related Posts