Install gcc on Windows
published: February 28, 2025
tags:
windows |
gcc |
c |
reading time: 1 minutes
If I ever find myself on Windows ever again (hopefully not), I just want to note that I found these to be the best steps to follow to install gcc on Windows.
Step 1: Install Chocolatey
On Ubuntu I love to hit the command-line to install software, Chocolatey brings that experience to Windows. It is a command-line package manager and installer for software on Windows. To install it just follow the instructions on the official Chocolatey website.
Step 1: Install gcc
Open Command Prompt as an Administrator and execute the following:
choco install mingw
Then execute refreshenv, after the installation process completes to load the changes made to the PATH environment variable. Then close and reopen the Command Prompt.
Then to test create hello.c:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
}
Then to run the compiled program:
hello.exe
or
.\test.exe
To check your gcc version
If you ever need to check your gcc version then execute the following from a Command Prompt:
gcc -v