C++ 如何在 Windows 上的 MinGW 中更新 GCC?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9865319/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update GCC in MinGW on Windows?
提问by Chan
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?
我以前习惯在 Ubuntu 上从源代码手动安装 GCC,这是一个痛苦的过程。所以我真的不想重复这个过程。目前,我的机器上安装了 MinGW 和 GCC (4.6.2)。那么有没有一种简单的方法来更新 GCC 而无需完全从源代码构建它?有没有人以前做过可以分享一些技巧?
采纳答案by sigman
Snapshots and release builds of the MinGW http://code.google.com/p/mingw-builds/downloads/list
MinGW 的快照和发布版本http://code.google.com/p/mingw-builds/downloads/list
回答by Yuriy Petrovskiy
Update using terminal:
使用终端更新:
Run the command prompt/terminal (
cmd
orsh
).Update the package list:
mingw-get update
After updating the package list, run:
mingw-get upgrade
运行命令提示符/终端(
cmd
或sh
)。更新包列表:
mingw-get update
更新包列表后,运行:
mingw-get upgrade
When the command finishes running, all of your packages will be upgraded.
当命令完成运行时,您的所有软件包都将升级。
Update using the GUI version:
使用 GUI 版本更新:
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:
如果你不习惯终端,还有一个名为“MinGW 安装管理器”的 MinGW 的 GUI 版本,它通常位于:
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.
当 GUI 打开时,点击
Installation -> Update Catalogue
。这将更新包列表。之后,点击
Installation -> Mark All Upgrades
。这将选择所有可以升级的包。最后,点击
Installation -> Apply Changes
以应用升级。
回答by GravityWell
UPDATE: As of Nov-5-2012, MinGWincludes 4.7.2 of the GCC compiler, which is the most current version. I personally will use the MinGW package, since it includes MSYSand 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.
更新:截至 2012 年 11 月 5 日,MinGW包括 GCC 编译器的 4.7.2,这是最新版本。我个人会使用MinGW的包,因为它包含了MSYS等工具,而且因为它是事实上的标准,希望得到更好的支持。唯一的缺点是包含的 GDB 不包含 Python 脚本,但我认为可以单独更新。
I don't know if you can update the GCC in MinGW, but there are alternative projects to MinGW with newer versions of GCC.
我不知道你是否可以更新 MinGW 中的 GCC,但是有新版本的 GCC 的 MinGW 替代项目。
The MinGW-buildsproject 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.
该MinGW的,建立项目提供了类似的MinGW但更新的GCC(4.7.2)的包装。将现有的 MinGW 移动到另一个文件夹后,我将文件解压缩到 c:\MinGW(因此我可以使用相同的路径)。只有 MinGW 有MSYS,所以如果你需要(我做了)从原始 MinGW 复制 msys 文件夹。
After installing MinGW-builds, the result of g++ --version:
安装MinGW-builds后,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.
标准 MinGW 附带的最新 GCC 目前是 4.7.0。我在 Code::Blocks 和最新的 wxWidgets 源代码中编译了几个简单的项目,似乎一切正常。
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 Pythonfeatures.
值得注意的是,MinGW-builds 包含一个启用 Python 脚本的 GDB 版本,以防您需要 STL 漂亮的打印机支持或其他GDB Python功能。
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.
另一个不错的选择是TDM-GCC,这是一个包含令人印象深刻的安装程序的项目,其中包括更新的 GCC 编译器 (4.7.1) 和支持工具。它是一个独立的包。据我所知,此包附带的 GDB 不支持 Python 脚本。
Finally there is the MinGW-w64project, 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.
最后是MinGW-w64项目,它是 MinGW 的一个分支。Rubenvb 发布了这个问题的答案,基于这个项目有很好的独立包(在个人构建文件夹中),其中包括更新的 GCC (4.7.2)。包含的 GDB 似乎启用了 Python 脚本。
回答by rubenvb
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.
我已经构建了一个更新的 GCC 4.7(它是在代码冻结中构建的,所以它应该与发行版等效)。此外,此版本包含<thread>
支持。
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.
该-GCC_linux包是你想要什么,如果你想用它在Linux上。只需提取某处并将mingw??/bin
目录添加到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.
PS:有一个本地 Windows 编译器和一个 Windows Clang 构建。我建议只在我的 GCC 4.6 版本之一中使用 Clang,因为它在 GCC 4.7 的 libstd++ 上有问题。将 Clang 包解压到与 GCC 包相同的目录中,它将开箱即用。
回答by b166er
回答by JerryGoyal
To get latest MinGW64 in Windows: https://sourceforge.net/projects/mingw-w64/?source=typ_redirect
在 Windows 中获取最新的 MinGW64:https://sourceforge.net/projects/mingw-w64/?source =typ_redirect
For all platforms: https://mingw-w64.org/doku.php/download
适用于所有平台:https: //mingw-w64.org/doku.php/download