How to update GCC in MinGW on Windows?

C++GccC++11Mingw

C++ Problem Overview


I'm used to manually install GCC from source before on Ubuntu and it was a painful process. So I really don't want to do repeat this process. Currently, I have MinGW and GCC (4.6.2) installed on my machine. So is there an easy way to update GCC without building it entirely from source? Has anyone done it before can share me some tips?

C++ Solutions


Solution 1 - C++

Update using terminal:

  1. Run the command prompt/terminal (cmd or sh).

  2. Update the package list:

    mingw-get update
    
  3. After updating the package list, run:

    mingw-get upgrade
    

When the command finishes running, all of your packages will be upgraded.


Update using the GUI version:

If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:

C:\MinGW\libexec\mingw-get\guimain.exe
  1. When the GUI is open, tap Installation -> Update Catalogue. This will update the package list.

  2. After that, tap Installation -> Mark All Upgrades. This will select all of the packages which can be upgraded.

  3. Finally, tap Installation -> Apply Changes to apply the upgrades.

Solution 2 - C++

Snapshots and release builds of the MinGW http://code.google.com/p/mingw-builds/downloads/list

Solution 3 - C++

UPDATE: As of Nov-5-2012, MinGW includes 4.7.2 of the GCC compiler, which is the most current version. I personally will use the MinGW package, since it includes MSYS and other tools, and since it is the defacto standard, I hope that it is better supported. The only drawback is the included GDB does not include Python scripting, but I think that can be updated separately.


I don't know if you can update the GCC in MinGW, but there are alternative projects to MinGW with newer versions of GCC.

The MinGW-builds project provides a package similar to MinGW but with an updated GCC (4.7.2). I extracted the files to c:\MinGW (so I could use the same path) after moving my existing MinGW to another folder. Only MinGW has MSYS, so if you need that (I did) copy the msys folder from the original MinGW.

After installing MinGW-builds, the result of g++ --version:

g++ (Built by MinGW-builds project) 4.7.2

The latest GCC that comes with standard MinGW is currently 4.7.0. I compiled a few simple projects in Code::Blocks, and the latest wxWidgets source, and everything seems to work.

It's worth noting that MinGW-builds includes a Python script enabled version of GDB, in case you want STL pretty printer support, or other GDB Python features.

Another good choice is TDM-GCC, which is a project that hosts an impressive installer that includes an updated GCC compiler (4.7.1) and support tools. It is a standalone package. As far as I can tell, Python scripting is not supported in the GDB that comes with this package.

Finally there is the MinGW-w64 project, which is a fork of MinGW. Rubenvb, who posted an answer to this question, has good standalone packages (in the personal builds folder) based on this project which include an updated GCC (4.7.2). The included GDB seems to be Python script enabled.

Solution 4 - C++

if you use MSYS2 just open mingw64-console and type in:

# Update the package database and core system packages with:
pacman -Syu  

# If needed, close MSYS2, run it again from Start menu. Update the rest with:
pacman -Su

Solution 5 - C++

I have built a more up to date GCC 4.7 (it's built within code freeze, so it should be equivalent with the release). Also, this build contains <thread> support.

The -gcc_linux package is what you want if you want to use it on Linux. Just extract somewhere and add the mingw??/bin directory to PATH.

PS: There's a native Windows compiler and a Windows Clang build. I suggest using Clang only with one of my GCC 4.6 builds, as it has trouble with GCC 4.7's libstd++. Extract the Clang package in the same directory as the GCC package and it will work out of the box.

Solution 6 - C++

The MinGW-w64 build from http://winlibs.com/ has the latest GCC version and requires no installation, just unzip the download. To upgrade you can just replace the mingw32 or mingw64 folder with the new version.

Solution 7 - C++

Solution 8 - C++

You just need to update your g++ compiler if its not.

First problem can be solved through this:

Update using the GUI version:

If you aren't used to the terminal, there is also a GUI version of MinGW called "MinGW Installation Manager", which is normally located at:

C:\MinGW\libexec\mingw-get\guimain.exe When the GUI is open, tap

Installation -> Update Catalogue

. This will update the package list.

After that, tap

Installation -> Mark All Upgrades

. This will select all of the packages which can be upgraded. Finally, tap

Installation -> Apply Changes 

to apply the upgrades.

2nd Problem could be that if you didn't updated the path of mingw in environment variables.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChanView Question on Stackoverflow
Solution 1 - C++Yuriy PetrovskiyView Answer on Stackoverflow
Solution 2 - C++sigmanView Answer on Stackoverflow
Solution 3 - C++GravityWellView Answer on Stackoverflow
Solution 4 - C++b166erView Answer on Stackoverflow
Solution 5 - C++rubenvbView Answer on Stackoverflow
Solution 6 - C++Brecht SandersView Answer on Stackoverflow
Solution 7 - C++GorvGoylView Answer on Stackoverflow
Solution 8 - C++Vishwanath Pratap SinghView Answer on Stackoverflow