Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

C/C++ Environment Setup

This guide will help you set up a clean and reliable environment for compiling and running C/C++ programs. It covers two approaches — a standard setup using MinGW (GCC for Windows) and an advanced setup using an open-source GitHub toolchain (to be detailed later).

A dedicated C/C++ environment allows you to:

  • Compile and run code reliably across systems
  • Avoid dependency or compiler version conflicts
  • Use modern editors like VS Code for debugging and builds
  • Reproduce consistent build results across teams or CI environments

Prerequisites

  • Windows system (Windows 10 or later recommended)
  • Basic familiarity with Command Prompt or PowerShell
  • (Optional) VS Code for editing and debugging
  • (Optional) For macOS/Linux, GCC or Clang compilers come preinstalled — skip directly to the verification step

Steps

MinGW from Installer

There are two primary ways to install MinGW on Windows:

a) Using MinGW-w64 Installer

  1. Visit the official MinGW-w64 download page.
  2. Choose the following packages to install by selecting Mark for Installation in the drop-down menu:
    • mingw-developer-toolkit
    • mingw32-base
    • mingw32-gcc-g++
    • mingw32-gcc-objc
    • msys-base
  3. Click on Installation → Apply Changes (button at the top-left corner).
  4. After installation completes, open the folder where you chose to install MinGW. By default, it is located at C:/MinGW.
  5. Open the bin folder and copy its path. By default, it will be C:/MinGW/bin.
  6. Search for Edit the system environment variables in the Windows search bar.
  7. Under the Advanced tab, click on Environment Variables.
  8. In the System variables section, select Path and click Edit.
  9. Click New and paste the copied path (C:/MinGW/bin) into the list. Then click OK.
  10. Congratulations! You have successfully completed the setup of your C/C++ source packages.

b) Using MSYS2 (Recommended)

  1. Download MSYS2 from msys2.org.
  2. Scroll down to the Installation section and choose the installer based on your PC’s architecture (for most users, this will be the x86_64 executable file).
  3. Open the MSYS2 64-bit Terminal.
  4. Update the package database and core system by running below command, when prompted, type y to confirm. The terminal will close automatically to apply changes:
    pacman -Syu
  5. Reopen the MSYS2 MSYS terminal and run below command, to check for further updates:
    pacman -Su
  6. Close the terminal again to apply the updates.
  7. Open the MSYS2 MinGW 64-bit terminal and install GCC:
    pacman -S mingw-w64-x86_64-gcc
  8. Install debugging tools:
    pacman -S mingw-w64-x86_64-gdb
  9. Note: If you encounter any errors while running the installer, check your environment variable setup. Similar to the standard MinGW method, add C:/msys64/mingw64/bin to your system’s environment variables.
  10. Congratulations! You have successfully installed the MSYS2 C/C++ packages.

MinGW from Open Source (Recommended)

  1. Navigate to the GitHub repository for releases by Skeeto.
  2. Download the .exe file (packaged as a .7z archive).
  3. If you don’t have 7-Zip installed, download it from the official 7-Zip website.
  4. Extract the executable file using 7-Zip.
  5. Save the extracted w64devkit folder anywhere on your system, and use its bin directory path to access C/C++ packages.
  6. Congratulations! You have successfully installed the latest open-source C/C++ toolchain.

Resources

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors