DEV Community

Cover image for How to install gcc in Windows 10? (the easier way)

How to install gcc in Windows 10? (the easier way)

Sudev Suresh Sreedevi on August 24, 2020

GCC, abbreviation for 'GNU Compiler Collection' (thanks @saphirakai ) (and not Gulf Cooperation Council, like I'd assumed) is a necessity if you (o...
Collapse
 
darthnithin profile image
Nithin

or just do choco install mingw

Collapse
 
artemiikravchuk profile image
Artemii Kravchuk

Thanks, that just saved me a lot of time lol!!!!
I didn't know it was possible, nobody writes about it...

Collapse
 
williycole profile image
William Cole Boren • Edited

self #smh #facepalm

Image description

Collapse
 
devchaudhary78 profile image
Dev Chaudhary

Amazing (:

Collapse
 
saphirakai profile image
Saphira Kai

GCC is not an acronym for GNU C Compiler, that's a misconception. It stands for GNU Compiler Collection, as GCC has support for many languages; including C++, Objective-C, Objective-C++, Fortran, Ada, D, and Go, not just C.

Collapse
 
devchaudhary78 profile image
Dev Chaudhary

Good Catch buddy (:

Collapse
 
jbrown123 profile image
James Brown

The mingw.org site is down (as noted above). However, the older SourceForge site has a stale copy. The new site is osdn.net/projects/mingw/

OP, please update the link above in the article to the new site.

Collapse
 
raddevus profile image
raddevus

Thanks for sharing this article. It has great info. After reading this I also found a great article on using Visual Studio Code on Win10 and mingw -- code.visualstudio.com/docs/languag.... It includes links directly to the installation of MinGW so that is helpful too.

Collapse
 
micro-pc-tech-inc profile image
Micro Pc Tech Inc

To install the GNU Compiler Collection (GCC) on Windows 10, you can use the MSYS2 environment, which provides a Unix-like shell and a package management system for Windows. Here's a step-by-step guide:

Install MSYS2:

Download the MSYS2 installer from the official website.
Run the installer and follow the on-screen instructions.
When prompted, choose the installation directory (the default is usually fine).
Update MSYS2:

Open the MSYS2 Shell that was installed with the MSYS2 package.

Run the following commands to update the package database and core system packages:
pacman -S mingw-w64-x86_64-toolchain
This may take some time as it updates the system.

Install GCC:

After the update, install the GCC package using the following command:
pacman -S mingw-w64-x86_64-toolchain
This will install the GCC compiler and related tools.

Add GCC to the System Path:

Once the installation is complete, you need to add the GCC binaries to the system path so that you can run them from any command prompt.

Locate the installation directory (default is C:\msys64).

Add the bin directory to the system path. You can do this by adding the following line to your system or user environment variables:
C:\msys64\mingw64\bin
Make sure to adjust the path if you installed MSYS2 in a different directory.

Verify Installation:

Open a new command prompt and type the following command to verify that GCC is installed:

bash
Copy code
gcc --version
You should see information about the GCC version.

That's it! You have successfully installed GCC on Windows 10 using MSYS2. You can now use GCC to compile C and C++ programs from the command line.

Collapse
 
sieler profile image
Stan Sieler

Hi...your (revised) article worked to perfection, thanks! (Installed gcc on 2021-05-03 on Win 10).

For me, gcc is only 80% of the bits I need ...

I also need: make

and: /usr/include/* (e.g., , )

I know I've found/installed them three or four times over the last 20+ years,
but each time it's a new challenge (hmmm...maybe better note keeping?)

thanks!
Stan

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt
Collapse
 
tingwei628 profile image
Tingwei

THANK YOU!

Collapse
 
sahin52 profile image
sahin52

You are perfect

Collapse
 
c0r2a profile image
Yuudai Ishihara

It was useful to me.
Thanks.

Collapse
 
nathanieldev profile image
NathanielDev

I created an account just to thank you for saving me the headache.

Collapse
 
mafee6 profile image
MAFEE7

Thank you so much!

Collapse
 
robertodermato profile image
ROBERTO LUIS REZENDE

You are a God!!! This article saved my day! Thank you very much!

Collapse
 
martinbrejniak profile image
Martin-Brejniak

THANK YOU SO MUCH! I literally just made an account so I can say that to you. Seriously, you just saved me from a massive headache!

Collapse
 
ramioma66914653 profile image
Abdo

Thank you for this useful article. I followed it but it installed version 6.3.0 for me, while I need version > 8 or the latest version. Could you please show how to to it? Thanks!

Collapse
 
eddiechaoinchina profile image
eddiechaoinchina

Thanks man, this approach killed it. Working perfectly on my PC right now.

Collapse
 
kumar_praveen96 profile image
Praveen Kumar

Please suggest as mingw site is not working

Collapse
 
eagerdas profile image
eagerdas

try mingw-w64.org/doku.php. Seems that the mingw site's domain has expired.

Collapse
 
coffeeout profile image
Daniil Danilov

Thank you very much.

Collapse
 
l9dsonwq profile image
Andelson nicolas

Thank you, still working until now. ❤️

Collapse
 
emilysquotespag profile image
Emilys quotes

Anyone else enjoys fishing here? Wanted to ask some questions if any professionals are available.
paperminecraft.us
flyordieio.com

Collapse
 
shrinidhi111 profile image
shrinidhi111

Just a small correction.

MinGW official site never went down; it got moved to osdn.net/projects/mingw/

Collapse
 
mafee6 profile image
MAFEE7 • Edited

Thank you so much

Collapse
 
emilysquotespag profile image
Emilys quotes

Why is education so expensive in the USA? This is actually a huge problem, a student with a loan of 50k and above in awful thing.

Collapse
 
awsiddiqui8 profile image
awsiddiqui

really helpful thanks

Collapse
 
pgllearning profile image
pgllearning

can someone tell me how to delete it?

Collapse
 
mohameddev2000 profile image
MED

Thanks bro that was super helpful :)

Collapse
 
mousavihn profile image
Hossein Mousavi

it worked very well, thank you very much