Writing
Article
AI
Art
Angular
Photoshop
Premiere
Animal Crossing
Blog
Story
Android
Android Studio
Davinci Resolve
CSS
Clipchamp
ChatGPT
Crypto
DALL-E
Discord
Davinci Resolve
Davinci Resolve 18
Dream Studio
Express
Filmora
Flutter
PC Games
Git
GPT
GPT3
GPT4
GTA
GTA 6
Ghost Together
Ghost Together
HTML
iOS
iMovie
Illustrator
JavaScript
Mac
Mongo
Midjourney
Minecraft
Node.js
NBA 2k24
OSX
PHP
Palworld
Python
Playground AI
Roblox
React
Recipe (Cooking)
React Native
Semicolon.dev
Starfield PC Game
Snapchat
Steam
Stable Diffusion
SVG
Threads
Text To Image (AI)
VSCode
Vim
Web Development
Windows
WebGL
Windows Tutorials

    How to Install MinGW w64 64-bit on Windows (C/C++ Compiler)

    GCC / G++ compilers are used to execute C & C++ code in Windows on command line

    viewed 50.5K times
    › windows › install mingw with gcc c++ on windows

    MinGW is often installed on your Windows system to enable C and C++ programming, in particular compiling programs written in those two languages via the gpp C code builder. Often, its for personal programming projects, like making games. Other times, some other software requires it, and therefore MinGW w64 (not exactly the same meaning as 64 bit, but often searched by that term) needs to be set up on your platform.

    How To Install MinGW w64 (64 bit) on Windows

    To install MinGW w64, follow these steps:

    • Go to winlibs.com
    • Scroll down and find the "UCRT runtime"
    • Download the "Zip archive" for Win64 (you can choose to download the one without clang)
    • Extract the mingw folder from zip and place it somewhere
    • Open mingw folder, there's a bin folder, open it
    • Copy the current path, e.g., "C:\mingw\bin"
    • Open environment variables editor
    • Open Path, add new and paste the above copied path

    That's all, you're done!

    (But if it's still not working, please see instructions below.)

    Install MinGW on Windows w64 64-bit

    You're here because you need to install MinGW (GCC and G++ builders) to compile C and C++ programs from command line (cmd.exe or Bash) on your system.

    Perhaps you are looking to compile C and C++ in Visual Studio Code. And that means you still need to install MinGW with GCC and G++ tools for running your C-language programs.

    Here's setup instructions for installing MinGW on your Windows-based system. This is the video you want to watch, if you need to install GCC and G++ compiler on a PC:

    Hey guys, in this Windows installation tutorial, I'll show you How To install MinGW Compiler on Windows 10 or 11. (The same process applies to Windows 7 as well.)

    Google is your best friend for finding correct MinGW installation files!

    Find MinGW Installation Files on Google

    Type mingw download and locate this MinGW Source Forge link (usually second link, after the first search result on Google.)

    (You don't want to navigate to official site, as it will send you in circles to the Source Forge download site anyway.)

    MinGW download files on Source Forge

    Locate this page and wait for file to download.

    Click on the downloaded MinGW file to start installation process:

    Download and Install MinGW compiler

    Right click on every single checkbox on the list, and select Mark for Installation.

    MinGW select all packages from checkboxes (right click, then Mark For Installation)

    How to add MinGW to my PATH System Variable in Windows' Environment Variables

    Now in order for our MinGW to become available for execition system-wide (from any location on the hard drive with the command line, not just from where it was installed,) we need to add the path to where MinGW was installed to Environment Variables.

    Open your MinGW installation location with File Explorer.

    Copy hard drive location where you installed MinGW in File Explorer, directly from the address bar (make sure to also include /bin folder as shown in following example):

    Copy MinGW binaries (bin) location to add them to System Environment PATH Variable in Windows

    In my case it was C:\MinGW\bin (I changed it from default location that used to be Program Files by default)

    Now to open Environment Variables window, go to Start button and simply start typing Environment Variables.

    Then, either hit Enter, or click on Open button.

    Go to Environment Variables button in the first window that shows up.

    Then on next screen locate PATH variable in the second box below under System Variables:

    How to add MinGW to system PATH variable in Windows' Environment Variables

    Click Edit button.

    Click Add button and type C:\MinGW\bin and save that variable.

    Click Ok 3 times as you exist Environment Variables windows to confirm changes.

    How to find out which version of MinGW I have installed on my computer?

    And finally...just to make sure you have MinGW successfully installed.

    Go to Start button, type cmd.exe and hit Enter or click Open button.

    Find out what version of MinGW I have from command line in cmd.exe

    In cmd.exe command prompt, enter the command g++ --version.

    Now that your MinGW binaries path was added to Environment Variables, you should be able to run this command from anywhere on your hard drive. Not just when you change directory to C:\MinGW\bin on the command line.

    And if that's the case, you've successfully installed MinGW on your Windows OS.

    This is also exactly what will allow you to compile C and C++ from IDEs like Microsoft's Visual Studio Code and JetBrains IntelliJ. Good luck out there!

    If errors show up and you don't see the screen from example above, make sure you properly added it to PATH. Also check if you can run it from C:\MinGW\bin directory. If you still get errors, something is terribly wrong.

    Please share this article if you found it helpful.

    Difference Between MinGW64 and MSYS2 / Avoid Broken Windows Headers

    I found this insightful piece of comments on Reddit. Hope this helps someone:

    I have the Msys64 package installed. It uses "pacman" to do installation and updates. Hope you've memorized the switches.

    The main problem with that distribution is that there can be confusion as to which shell you need to run to get things done:

    1. "mingw32" shell
    2. "mingw64" shell
    3. "msys2" shell

    You'd think that mingw64 and msys2 would provide the same C compiler environment, but they do not. The msys2 is intended on building programs that run under the msys2 shell, and not for general use.

    Additionally, the Windows headers that are included by the msys2 GCC compiler are incompatible with standard Windows headers.

    As for how to install the compilers, if you literally ask for just gcc, you get the MSYS2 version of GCC, not the Mingw64 version of gcc, so you get broken Windows headers, unless you knew in advance not to download the gcc package.

    Let's Ghost Together
    Sign Up Now  -  It's Free!

    Articles Related To Undefined Community

    Last 10 Articles Written On Ghost Together

    Last 10 Undefined Questions Asked On Ghost Overflow

    Write For Us
    Sign Up Now  -  It's Free!

    How to Install MinGW w64 64-bit on Windows (C/C++ Compiler)

    Comments (2) New! (You can now post comments on articles!)

    (By posting a comment you are registering a Ghost Together account.)
    Register
    Register
    Post It
    DM Coming Soon
    f f