How to update GCC in MinGW on Windows?

108,816

Solution 1

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

Solution 2

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

Solution 4

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

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.

Share:
108,816
roxrook
Author by

roxrook

C++ is fun!

Updated on July 05, 2022

Comments

  • roxrook
    roxrook almost 2 years

    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?

  • Kan Li
    Kan Li about 12 years
    Is it OK to simply unzip the x86_64-mingw32-gcc-4.7.0-release-c,c++,fortran-sjlj.zip and put into current MinGW installation? Will this break something because of library incompatibility? Does it basically disables mingw-get so that it no longer tracks update for gcc?
  • Anthony Burleigh
    Anthony Burleigh over 11 years
    As linked in @GravityWe11's answer, MinGW-builds has moved to sourceforge. You'll see already a few newer releases here such as GCC 4.7.2 builds. Just adding an update for any future users.
  • Zyl
    Zyl about 9 years
    ´mingw-get upgrade´ crashes ("[...] has stopped working."). Any idea why?
  • Ignas2526
    Ignas2526 almost 9 years
    At this moment, MinGW-w64 includes latest GCC version: 5.1.0 . I would say it is the best option after compiling everything yourself.
  • Antony Thomas
    Antony Thomas almost 9 years
    For reference: You can also launch the GUI version by just typing mingw-get without arguments
  • Srijan Chaudhary
    Srijan Chaudhary about 4 years
    You can also directly go to MinGW official website from mingw.org and select download to choose the required download from