How to Install MinGW (GCC/G++) Compiler on Windows 10 or 11

preview_player
Показать описание
#mingw #gcc #cplusplus #compiler #download #install

In this 2022/2023 tutorial I'll show you How To install MinGW Compiler on Windows. You need MinGW to compile C and C++ programs from command line on your system.

Fix There is no script engine for file extension .js

How to install MinGW on windows 10 or 11
=====
00:00 How to Install MinGW on Windows 10
00:17 Downloading MinGW from SourceForge (not the official site)
00:50 Install MinGW
01:19 There is no script engine for file extension .js error - Just click OK
01:29 Right click on every checkbox and select "Mark For Installation" option
01:54 Click Installation Option on Drop Down Menu and click "Apply Changes"
02:18 Go to your File Explorer and locate C:\MinGW\bin folder, and copy its address
02:41 Go to Start button and type Environment Variables
02:58 Add C:\MinGW\bin to PATH under System Variables
03:34 CHeck if MinGW was installed and its version

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.)

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.

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.

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.

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.

Difference Between MinGW64 and MSYS2 / Avoid Broken Windows Headers

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.
Рекомендации по теме
Комментарии
Автор

I had been trying to install a compiler for 2 days and i just could not figure out what I was doing wrong. I still didnt but with your video it finally installed so i can get started, Thank you!!

kellymonserratcarbajalarau
Автор

Thank you very much! You helped me with this video!

gretchensuarez
Автор

some packages failed to download during installation. how do I fix it

godswillnwankwo
Автор

Thank you sir, It worked after I followed the guide but I did have to do a restart of pc for some reason

MrZaaa