How to update GCC in MinGW on Windows?

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?


Solution 1:

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:

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

Solution 3:

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.