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
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.)
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!
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.)
Locate this page and wait for file to download.
Click on the downloaded MinGW file to start installation process:
Right click on every single checkbox on the list, and select 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):
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:
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.
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:
- "mingw32" shell
- "mingw64" shell
- "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.
Articles Related To Undefined Community
- DaVinci Resolve 18: How To Brighten Video Clip on 23 Dec 2022 by Ghost Together
- How To Fade Out In DaVinci Resolve (Fade In To and From Black) on 20 Dec 2022 by Ghost Together
- How To Animate Zoom Effect In DaVinci Resolve 18 on 20 Dec 2022 by Ghost Together
- Zoom In On Video Clip In Davinci Resolve 18 on 18 Dec 2022 by Ghost Together
- asdasdasdasdasd on 10 Dec 2022 by Ghost Together
- How To Crop Video In Premiere Pro on 20 Sep 2022 by Ghost Together
- DIY Life, Love, and Violence -- Taking it to the Streets on 9 Sep 2022 by A. Stranger
- How To Change Font Size In VSCode (Visual Studio Code) on 29 Jul 2022 by Ghost Together
- How To Fix MinGW File Downloaded Incorrectly on 30 Jul 2022 by Ghost Together
- Shrink or Expand Text Selection (VS Code Keyboard Shortcut) on 27 Mar 2022 by Ghost Together
Last 10 Articles Written On Ghost Together
- adad on 29 Feb 2024 by Myriad585
- test on 26 Feb 2024 by Await762
- مقاله کامل راهنمای کامل خرید و استفاده از کیف کمری و تاریخچه مزایا ومعایب انوا... on 23 Feb 2024 by Async667
- complaint about MPD dispenser at petrol pump not working on 23 Feb 2024 by Layout222
- new here, on 21 Feb 2024 by Rainbow726
- hello on 19 Feb 2024 by Bracket393
- GT COIN Draft on 14 Feb 2024 by A. Stranger
- Effective Techniques For Working With Filesystem Streams, Events And Common Objec... on 9 Feb 2024 by Ghost Together
- First Post on 8 Feb 2024 by Semicolon199.40131659899873
- The Top 10 Concerns About Donald Trump's Reelection on 6 Feb 2024 by Myriad429
Last 10 Undefined Questions Asked On Ghost Overflow
- Ask your first Undefined question! (Help us build the largest database of questions on any subject)