How to update GCC in MinGW on Windows?

2019-01-21 09:04发布

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?

6条回答
聊天终结者
2楼-- · 2019-01-21 09:21

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.

查看更多
Animai°情兽
3楼-- · 2019-01-21 09:26

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.

查看更多
Summer. ? 凉城
4楼-- · 2019-01-21 09:29

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
查看更多
家丑人穷心不美
5楼-- · 2019-01-21 09:31

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

查看更多
Explosion°爆炸
7楼-- · 2019-01-21 09:38
  1. Run shell (cmd or sh)
  2. Update package list (need Internet connection):

    mingw-get update

  3. After this run upgrade

    mingw-get upgrade

After this your mingw packages should be upgraded to latest versions.

There is also GUI version called MinGW Installation Manager and located typicaly at

C:\MinGW\libexec\mingw-get\guimain.exe
查看更多
登录 后发表回答