๐ŸŒ
Visual Studio Code
code.visualstudio.com โ€บ docs โ€บ cpp โ€บ config-mingw
Using GCC with MinGW
November 3, 2021 - In this tutorial, you configure Visual Studio Code to use the GCC C++ compiler (g++) and GDB debugger from mingw-w64 to create programs that run on Windows.
GNU development software for Windows
MinGW GCC For M68K
Mingw-w64 is a free and open-source suite of development tools that generate Portable Executable (PE) binaries for Microsoft Windows. It was forked in 2005โ€“2010 from MinGW (Minimalist GNU for Windows). Mingw-w64 includes โ€ฆ Wikipedia
Factsheet
MinGW-w64
Original author OneVision Software
Developers Kai Tietz, Jonathan Yong, various GNU contributors
Factsheet
MinGW-w64
Original author OneVision Software
Developers Kai Tietz, Jonathan Yong, various GNU contributors
๐ŸŒ
mingw-w64
mingw-w64.org
mingw-w64
A complete runtime environment for GCC & LLVM for 32-bit (x86), 64-bit (x64), and ARM64 Windows
๐ŸŒ
SourceForge
sourceforge.net โ€บ projects โ€บ mingw
MinGW - Minimalist GNU for Windows download | SourceForge.net
MinGW: A native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality.
Rating: 4.3 โ€‹ - โ€‹ 223 votes
๐ŸŒ
GNU
gcc.gnu.org โ€บ install โ€บ binaries.html
Installing GCC: Binaries - GNU Project
Microsoft Windows: The Cygwin project; the mingw-w64 project. OpenPKG offers binaries for quite a number of platforms. The GFortran Wiki has links to GNU Fortran binaries for several platforms. Return to the GCC Installation page
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 1465401 โ€บ how-do-i-install-gcc-compiler-on-windows-10-64-bit
How do I install GCC compiler on Windows 10 (64 bit)? | Sololearn: Learn to code for FREE!
Its easy to install GCC on your windows machine. Just download TDM Gcc compiler here is a link to it. https://sourceforge.net/projects/tdm-gcc/ Once you install it you are good to go. Make your C program and save it as .C extension.
๐ŸŒ
PhoenixNAP
phoenixnap.com โ€บ home โ€บ kb โ€บ devops and development โ€บ how to install gcc on windows
How to Install GCC on Windows
September 23, 2024 - Install GCC on Windows using one of three methods: MinGW-w64, Chocolatey, or Windows Subsystem for Linux (WSL).
๐ŸŒ
WinLibs
winlibs.com
WinLibs - GCC+MinGW-w64 compiler for Windows
Win64 - x86_64 - Windows 64-bit version, runs natively on and compiles for Windows 64-bit (will not run on Windows 32-bit) Don't worry. For most purposes the latest Windows 64-bit release version with MSVCRT runtime and POSIX threads is a good choice. Download it here. GCC 15.2.0 (with POSIX threads) + MinGW-w64 13.0.0 (UCRT) - release 6 (LATEST)
Find elsewhere
๐ŸŒ
DEV Community
dev.to โ€บ gamegods3 โ€บ how-to-install-gcc-in-windows-10-the-easier-way-422j
GCC for Windows: How to install gcc in Windows 10? (the easier way) - DEV Community
December 12, 2021 - 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.
๐ŸŒ
Preshing
preshing.com โ€บ 20141108 โ€บ how-to-install-the-latest-gcc-on-windows
How to Install the Latest GCC on Windows
You can add them all in one fell swoop. Just open a Command Prompt (in Windows), navigate to the folder where the Cygwin installer is located, and run the following command: C:\cygwin64>setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel
๐ŸŒ
Medium
medium.com โ€บ @anazilthottunghal โ€บ a-guide-to-installing-gcc-on-windows-5cc95c2f38c4
A Guide to Installing GCC on Windows. | by Muhammed Anazil. T. A | Medium
December 5, 2023 - Mingw-w64 is a development environment for Windows, including GCC, which allows you to compile and run C and C++ programs. ... Once the installer is downloaded, run the executable file.
Top answer
1 of 3
41

There are several ways to go here:

Option 1: Create a Custom Build Tool

Visual Studio 2005 and newer will let you register custom build tools. They tell the IDE how to transform files of one form (e.g. a .cpp file) into another form (e.g. an .obj file).

So far as I know, no one has done this yet for GCC. And, doing it yourself requires writing COM code, which is probably too deep a pool to dive into just for a single project. You'd have to have a compelling reason to take this project on.

You then have to manually adjust each project to tell it to use the custom build tool instead of the default, since you're using a file name extension (.cpp, probably) that Visual C++ already knows about. You'll run into trouble if you try to mix the VC++ and g++ compilers for a single executable built from multiple modules.

On the plus side, if you were looking to start an open source project, this sounds like a good one to me. I expect you'd quickly gather a big user base.

Option 2: Makefile Project

  1. Start Visual Studio and say File > New Project.

  2. In the Visual C++ section, select Makefile Project

  3. Fill out the Makefile Project Wizard:

    • Build command line: make
    • Clean commands: make clean
    • Rebuild command line: make clean all

You can leave the Output (for debugging) field alone if you've named your executable after the project name and it lands where Visual Studio expects to find it.

Leave the rest of the fields alone unless you know what they are and why you want to change them. As an example, you might choose to pass a -D flag on the Preprocessor definitions line to get separate debug and release outputs. If you know you want this, you know how to set it up, so I'm not going to make this long answer even longer in order to explain it.

You'll be asked the same set of questions for the Release build. If you want to bother with separate debug and release builds, you'd make any changes here.

Having done all this, you still have to create the Makefile, and add a make.exe to your PATH. As with the debug vs. release question, going into that level of detail would push this answer off topic.

As ugly as this looks, it's still easier than creating custom build tools. Plus, you say you need to port to Unix eventually, so you're going to need that Makefile anyway.

Option 3: Cross-Platform Development

You say you want to port this program to Unix at some point, but that doesn't mean you must use GCC on Windows now. It is quite possible to write your program so that it builds under Visual C++ on Windows and GCC/Makefiles on *ix systems.

There are several tools that make this easier. One very popular option is CMake, which is available as an installation time option in newer versions of Visual Studio. There are many alternatives such as SCons and Bakefile.

2 of 3
7

Clang

You can use the Clang compiler with Visual Studio to target Android, iOS, and Windows.

If you are targeting Android, you can use the Clang/LLVM compiler that ships with the Android NDK and toolchain to build your project. Likewise, Visual Studio can use Clang running on a Mac to build projects targeting iOS. Support for Android and iOS is included in the โ€œMobile Development with C++โ€ workload. For more information about targeting Android or iOS check out our posts tagged with the keywords โ€œAndroidโ€ and โ€œiOSโ€.

If you are targeting Windows, you have a few options:

  1. Use Clang/LLVM; โ€œClang for Windowsโ€ includes instructions to install Clang/LLVM as a platform toolset in Visual Studio.
  2. Use Clang to target Windows with Clang/C2 (Clang frontend with Microsoft Code Generation).

GCC

If your project targets Linux or Android, you can consider using GCC. Visual Studioโ€™s C++ Android development natively supports building your projects with the GCC that ships with the Android NDK, just like it does for Clang. You can also target Linux โ€“ either remotely or locally with the Windows Subsystem for Linux โ€“ with GCC.

Check out our post on Visual C++ for Linux Development for much more info about how to use Visual Studio to target Linux with GCC. If you are specifically interested in targeting WSL locally, check out Targeting WSL from Visual Studio.

Source: https://devblogs.microsoft.com/cppblog/use-any-c-compiler-with-visual-studio/

๐ŸŒ
Instructables
instructables.com โ€บ design โ€บ software
Learn to Install GCC (Mingw-w64) Compiler Tools on Windows 10 Using MSYS2 : 9 Steps - Instructables
November 28, 2022 - Learn to Install GCC (Mingw-w64) Compiler Tools on Windows 10 Using MSYS2: We will learn How to install 64 bit (GCC) GNU Compiler Collection on a Windows 10 system using MSYS2 installer for C/C++ software development. After installing GCC, we will compile a Win32/64 GUI applicaโ€ฆ
๐ŸŒ
GitHub
gist.github.com โ€บ alandsilva26 โ€บ 53cd2fecf253554c2f671766d3df5d66
Instructions for installing GCC Compiler on Windows ยท GitHub
This will install the linux shell on your Machine. Update packages and mirrors using pacman -Syu. ... Note: Keep pressing ENTER to select the default installation instructions. pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain \git subversion mercurial \mingw-w64-i686-cmake mingw-w64-x86_64-cmake ยท This command will take a while to download and install all files. After this GCC is installed but you still need to add it to your path.
๐ŸŒ
DEV Community
dev.to โ€บ gamegods3 โ€บ how-to-install-gcc-in-windows-10-the-easier-way-422j โ€บ comments
[Discussion] How to install gcc in Windows 10? (the easier way) โ€” DEV Community
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.
๐ŸŒ
Host IT Smart
hostitsmart.com โ€บ manage โ€บ knowledgebase โ€บ 435 โ€บ install-gcc-compiler-on-windows.html
How to Install GCC Compiler on Windows?
May 21, 2025 - Learn step-by-step how to install the GCC compiler on Windows. Follow this guide to effortlessly set up GCC for C and C++ programming on your Windows system.
๐ŸŒ
SourceForge
sourceforge.net โ€บ projects โ€บ gcc-win64
gcc-win64 download | SourceForge.net
Download gcc-win64 for free. x64 build of GCC for Windows. x64 C/C++ compiler for Windows using (unofficial build): - gmp - mpfr - mpc - isl - cloog - mingw-w64 - gcc - seh You need at least core2 command set support to run this application. Note that every version with bundled gdb needs at ...
๐ŸŒ
LinkedIn
linkedin.com โ€บ pulse โ€บ installing-gcc-compiler-windows-run-c-program-gitbash-david-michael
Installing GCC Compiler in Windows To Run C Program on Gitbash and Setting the PATH Variable
February 5, 2023 - GCC, or GNU Compiler Collection, is a popular open-source compiler used for developing and executing various programming languages, including C, C++, Fortran, Ada, and more. In this article, we will guide you through the process of installing ...
Top answer
1 of 5
96

EDIT Since not so recently by now, MinGW-w64 has "absorbed" one of the toolchain building projects. The downloads can be found here. The installer should work, and allow you to pick a version that you need.

Note the Qt SDK comes with the same toolchain. So if you are developing in Qt and using the SDK, just use the toolchain it comes with.

Another alternative that has up to date toolchains comes from... harhar... a Microsoft developer, none other than STL (Stephan T. Lavavej, isn't that a spot-on name for the maintainer of MSVC++ Standard Library!). You can find it here. It includes Boost.

Another option which is highly useful if you care for prebuilt dependencies is MSYS2, which provides a Unix shell (a Cygwin fork modified to work better with Windows pathnames and such), also provides a GCC. It usually lags a bit behind, but that is compensated for by its good package management system and stability. They also provide a functional Clang with libc++ if you care for such thing.

I leave the below for reference, but I strongly suggest against using MinGW.org, due to limitations detailed below. TDM-GCC (the MinGW-w64 version) provides some hacks that you may find useful in your specific situation, although I recommend using vanilla GCC at all times for maximum compatibility.


GCC for Windows is provided by two projects currently. They both provide a very own implementation of the Windows SDK (headers and libraries) which is necessary because GCC does not work with Visual Studio files.

  1. The older mingw.org, which @Mat already pointed you to. They provide only a 32-bit compiler. See here for the downloads you need:

    • Binutils is the linker and resource compiler etc.
    • GCC is the compiler, and is split in core and language packages
    • GDB is the debugger.
    • runtime library is required only for mingw.org
    • You might need to download mingw32-make seperately.
    • For support, you can try (don't expect friendly replies) [email protected]

    Alternatively, download mingw-get and use that.

  2. The newer mingw-w64, which as the name predicts, also provides a 64-bit variant, and in the future hopefully some ARM support. I use it and built toolchains with their CRT. Personal and auto builds are found under "Toolchains targetting Win32/64" here. They also provide Linux to Windows cross-compilers. I suggest you try a personal build first, they are more complete. Try mine (rubenvb) for GCC 4.6 to 4.8, or use sezero's for GCC 4.4 and 4.5. Both of us provide 32-bit and 64-bit native toolchains. These packages include everything listed above. I currently recommend the "MinGW-Builds" builds, as these are currently sanctioned as "official builds", and come with an installer (see above).

    For support, send an email to [email protected] or post on the forum via sourceforge.net.

Both projects have their files listed on sourceforge, and all you have to do is either run the installer (in case of mingw.org) or download a suitable zipped package and extract it (in the case of mingw-w64).

There are a lot of "non-official" toolchain builders, one of the most popular is TDM-GCC. They may use patches that break binary compatibility with official/unpatched toolchains, so be careful using them. It's best to use the official releases.

2 of 5
26

Download mingw-get and simply issue:

mingw-get install gcc.

See the Getting Started page.

๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ c-compiler-windows-gcc
Install C/GCC Compiler for Windows | DigitalOcean
August 3, 2022 - One of the preferred way to install C/GCC compiler is to use CodeBlocks. Just install it, launch it and start coding to keep things simple. In other words, CodeBlocks is a free C/C++ IDE that comes with the built-in compiler. Download codeblocks from www.codeblocks.org/downloads/binaries for ...