C/C++ Setup on Windows
This guide will help you install everything you need to write and run C/C++ programs on Windows. Don’t worry if you’re new to this - we’ll go through each step carefully!
What We’re Installing and Why
MinGW = A free C/C++ compiler for Windows. Think of it as the tool that turns your C code into programs that can actually run on your computer.
Prerequisites (What You Need First)
Windows 7 or newer
At least 1 GB of free space on your hard drive
At least 1 GB of RAM
Internet connection
Administrator access (ability to install programs)
Note: You can use tools from the resources
folder, but I recommend downloading the latest versions from official websites.
Step 1: Download MinGW
MinGW is the compiler that will turn your C/C++ code into working programs.
Go to the download page:
Visit SourceForge MinGW page
Look for a “Download Latest Version” button
Click it and wait for the download to start
The file will be called something like mingw-get-setup.exe
Alternative: If the download is slow, check if mingw-get-setup.exe
is available in your resources/windows/
folder
Step 2: Install MinGW
Now we’ll install the compiler on your computer.
Run the installer:
Find the downloaded file (usually in your Downloads folder)
Double-click mingw-get-setup.exe
If Windows asks “Do you want to allow this app to make changes?”, click “Yes”
Follow the installation wizard:
Click the “Install” button
Click “Continue”
Wait while it downloads some files (this might take a few minutes)
When it’s done, click “Continue” again
Choose what to install:
You’ll see a window called “MinGW Installation Manager” with a list of packages
Find these two items in the list:
mingw32-base
mingw32-gcc-g++
For each one: Right-click on it and select “Mark for Installation”
You should see a small arrow or checkmark appear next to each one
Install the selected packages:
Click “Installation” in the top menu
Click “Apply Changes”
Click “Apply” in the popup window
Wait for the installation to complete (this can take 5-10 minutes)
When it’s done, click “Close”
Close the MinGW Installation Manager window
Step 3: Add MinGW to Your System PATH
This step tells Windows where to find your new compiler. Don’t worry - it sounds technical but it’s just a few clicks!
What is PATH? It’s like giving Windows a map of where to find programs when you ask for them.
Open Environment Variables:
Press the Windows key and type “environment variables”
Click on “Edit the system environment variables”
Click the “Environment Variables…” button at the bottom
Edit the PATH:
In the bottom section (System variables), scroll down and find “Path”
Click on “Path” to select it
Click the “Edit…” button
Click “New” to add a new entry
Type: C:\MinGW\bin
Click “OK” three times to close all the windows
What did we just do? We told Windows that when you type compiler commands, it should look in the MinGW folder to find them.
Step 4: Test Your Installation
Let’s make sure everything is working properly!
Open Command Prompt:
Press Windows key + R
Type cmd
and press Enter
A black window will open - this is the Command Prompt
Test the C compiler:
Type: gcc --version
Press Enter
You should see something like:
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
Test the C++ compiler:
Type: g++ --version
Press Enter
You should see similar version information
If both commands show version information, congratulations! Your setup is complete!
What if Something Goes Wrong?
Problem: “gcc is not recognized as an internal or external command”
This means Windows can’t find your compiler. Here’s how to fix it:
Check if MinGW is installed:
Open File Explorer
Go to your C: drive
Look for a folder called “MinGW”
Inside MinGW, there should be a “bin” folder
Inside the bin folder, you should see files like gcc.exe
and g++.exe
If the MinGW folder exists but the command still doesn’t work:
Go back to Step 3 and double-check the PATH setup
Make sure you typed C:\MinGW\bin
exactly (with correct slashes and capitalization)
Important: Close and reopen Command Prompt after changing PATH
If MinGW folder doesn’t exist:
Go back to Step 2 and reinstall MinGW
Make sure you selected both packages and applied the changes
Problem: Downloads are very slow
Try using the files from the resources
folder if available
Or try downloading at a different time when internet is less busy
Problem: “Access denied” errors
Make sure you’re running as Administrator
Right-click on the installer and choose “Run as administrator”
Quick Summary
Here’s what you just accomplished:
Downloaded MinGW (your C/C++ compiler)
Installed the compiler on your computer
Told Windows where to find the compiler
Tested that everything works
What’s Next?
Now that you have a working C/C++ compiler:
Install VSCode - Follow the VSCode Setup Guide to get a nice editor
Write your first program - Try creating a simple “Hello World” program
Practice - The more you use it, the more comfortable you’ll become
Optional: Graphics Programming - If you want to create graphical programs, check out Graphics Library Setup Guide
Understanding What You Installed
gcc = The C compiler (turns .c files into programs)
g++ = The C++ compiler (turns .cpp files into programs)
MinGW = The package that includes both compilers and other tools
PATH = The list of folders where Windows looks for programs
Your Windows computer is now ready for C/C++ programming!
Troubleshooting Tips:
Always close and reopen Command Prompt after changing PATH
If something doesn’t work, try restarting your computer
Keep the MinGW Installation Manager - you might need it later to add more tools