如何在 Windows 7 机器上安装 gcc?

本文介绍了如何在 Windows 7 机器上安装 gcc?的处理方法,对大家解决问题具有一定的参考价值

问题描述

我的 Windows 7 机器上有 MinGW.我希望为 C 编译器安装和使用完整的 gcc.我发现没有用于此目的的单个预编译现成安装文件.我检查了以下页面:http://gcc.gnu.org/install/这很困难,我发现它超出了我的理解水平.任何人都可以为我提供一步一步的指导和链接吗?

I have MinGW on my windows 7 machine. I wish to install and use complete gcc for C compiler. I found there is no single pre-compiled ready-made installation file for this purpose. I checked the following page : http://gcc.gnu.org/install/ It is difficult and I find it above my level of understanding. Could any one please provide me step by step guidance along with links?

推荐答案

EDIT 从最近到现在,MinGW-w64 已经吸收"了其中一个工具链构建项目.可以在此处找到下载.安装程序应该可以工作,并允许您选择所需的版本.

EDIT Since not so recently by now, MinGW-w64 has "absorbed" one of the toolchain building projects. The downloads can be found here. The installer should work, and allow you to pick a version that you need.

请注意,Qt SDK 带有相同的工具链.因此,如果您使用 Qt 进行开发并使用 SDK,只需使用它附带的工具链即可.

Note the Qt SDK comes with the same toolchain. So if you are developing in Qt and using the SDK, just use the toolchain it comes with.

另一种具有最新工具链的替代方案来自......哈哈......一位微软开发人员,正是 STL(Stephan T. Lavavej,对于 MSVC++ 标准库的维护者来说,这不是一个恰当的名字!).您可以在此处找到它.它包括 Boost.

Another alternative that has up to date toolchains comes from... harhar... a Microsoft developer, none other than STL (Stephan T. Lavavej, isn't that a spot-on name for the maintainer of MSVC++ Standard Library!). You can find it here. It includes Boost.

如果您关心预构建的依赖项,另一个非常有用的选项是 MSYS2,它提供了一个 Unix shell(一个 Cygwin fork 修改为更好地与 Windows 路径名等一起工作),还提供了一个 GCC.它通常有点落后,但这可以通过其良好的包管理系统和稳定性来弥补.如果您关心此类事情,它们还提供带有 libc++ 的函数式 Clang.

Another option which is highly useful if you care for prebuilt dependencies is MSYS2, which provides a Unix shell (a Cygwin fork modified to work better with Windows pathnames and such), also provides a GCC. It usually lags a bit behind, but that is compensated for by its good package management system and stability. They also provide a functional Clang with libc++ if you care for such thing.

我将以下内容留作参考,但由于下面详述的限制,我强烈建议不要使用 MinGW.org.TDM-GCC(MinGW-w64 版本)提供了一些在您的特定情况下可能有用的技巧,但我建议始终使用 vanilla GCC 以获得最大兼容性.

I leave the below for reference, but I strongly suggest against using MinGW.org, due to limitations detailed below. TDM-GCC (the MinGW-w64 version) provides some hacks that you may find useful in your specific situation, although I recommend using vanilla GCC at all times for maximum compatibility.

GCC for Windows 目前由两个项目提供.它们都提供了自己的 Windows SDK(头文件和库)实现,这是必要的,因为 GCC 不适用于 Visual Studio 文件.

GCC for Windows is provided by two projects currently. They both provide a very own implementation of the Windows SDK (headers and libraries) which is necessary because GCC does not work with Visual Studio files.

  1. 较旧的 mingw.org,@Mat 已经向您指出.它们仅提供 32 位编译器.请参阅此处以获取您需要的下载:

  • Binutils 是链接器和资源编译器等.
  • GCC 是编译器,分为核心包和语言包
  • GDB 是调试器.
  • 只有 mingw.org 需要运行时库
  • 您可能需要单独下载 mingw32-make.
  • 如需支持,您可以尝试(不要指望友好回复)mingw-users@lists.sourceforge.net

或者,下载 mingw-get 并使用它.

Alternatively, download mingw-get and use that.

较新的 mingw-w64,顾名思义,也提供了 64 位变体,并且希望在未来提供一些 ARM 支持.我使用它并用他们的 CRT 构建工具链.个人和自动构建可在面向 Win32/64 的工具链"下找到此处.他们还为 Windows 交叉编译器提供 Linux.我建议您先尝试个人构建,它们更完整.在 GCC 4.6 到 4.8 中尝试使用我的 (rubenvb),或者在 GCC 4.4 和 4.5 中使用 sezero.我们都提供 32 位和 64 位原生工具链.这些软件包包括上面列出的所有内容.我目前推荐MinGW-Builds"版本,因为它们目前被批准为官方版本",并带有安装程序(见上文).

The newer mingw-w64, which as the name predicts, also provides a 64-bit variant, and in the future hopefully some ARM support. I use it and built toolchains with their CRT. Personal and auto builds are found under "Toolchains targetting Win32/64" here. They also provide Linux to Windows cross-compilers. I suggest you try a personal build first, they are more complete. Try mine (rubenvb) for GCC 4.6 to 4.8, or use sezero's for GCC 4.4 and 4.5. Both of us provide 32-bit and 64-bit native toolchains. These packages include everything listed above. I currently recommend the "MinGW-Builds" builds, as these are currently sanctioned as "official builds", and come with an installer (see above).

如需支持,请发送电子邮件至 mingw-w64-public@lists.sourceforge.net 或通过 sourceforge.net 在论坛上发帖.

For support, send an email to mingw-w64-public@lists.sourceforge.net or post on the forum via sourceforge.net.

两个项目都在 sourceforge 上列出了它们的文件,您所要做的就是运行安装程序(在 mingw.org 的情况下)或下载合适的压缩包并解压缩(在 mingw-w64 的情况下).

Both projects have their files listed on sourceforge, and all you have to do is either run the installer (in case of mingw.org) or download a suitable zipped package and extract it (in the case of mingw-w64).

有很多非官方"工具链构建器,其中最受欢迎的是 TDM-GCC.他们可能会使用破坏与官方/未打补丁的工具链的二进制兼容性的补丁,所以要小心使用它们.最好使用官方版本.

There are a lot of "non-official" toolchain builders, one of the most popular is TDM-GCC. They may use patches that break binary compatibility with official/unpatched toolchains, so be careful using them. It's best to use the official releases.

这篇关于如何在 Windows 7 机器上安装 gcc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,WP2

admin_action_{$_REQUEST[‘action’]}

do_action( "admin_action_{$_REQUEST[‘action’]}" )动作钩子::在发送“Action”请求变量时激发。Action Hook: Fires when an ‘action’ request variable is sent.目录锚点:#说明#源码说明(Description)钩子名称的动态部分$_REQUEST['action']引用从GET或POST请求派生的操作。源码(Source)更新版本源码位置使用被使用2.6.0 wp-admin/admin.php:...

日期:2020-09-02 17:44:16 浏览:1157

admin_footer-{$GLOBALS[‘hook_suffix’]}

do_action( "admin_footer-{$GLOBALS[‘hook_suffix’]}", string $hook_suffix )操作挂钩:在默认页脚脚本之后打印脚本或数据。Action Hook: Print scripts or data after the default footer scripts.目录锚点:#说明#参数#源码说明(Description)钩子名的动态部分,$GLOBALS['hook_suffix']引用当前页的全局钩子后缀。参数(Parameters)参数类...

日期:2020-09-02 17:44:20 浏览:1058

customize_save_{$this->id_data[‘base’]}

do_action( "customize_save_{$this->id_data[‘base’]}", WP_Customize_Setting $this )动作钩子::在调用WP_Customize_Setting::save()方法时激发。Action Hook: Fires when the WP_Customize_Setting::save() method is called.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分,$this->id_data...

日期:2020-08-15 15:47:24 浏览:798

customize_value_{$this->id_data[‘base’]}

apply_filters( "customize_value_{$this->id_data[‘base’]}", mixed $default )过滤器::过滤未作为主题模式或选项处理的自定义设置值。Filter Hook: Filter a Customize setting value not handled as a theme_mod or option.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分,$this->id_date['base'],指的是设置...

日期:2020-08-15 15:47:24 浏览:883

get_comment_author_url

过滤钩子:过滤评论作者的URL。Filter Hook: Filters the comment author’s URL.目录锚点:#源码源码(Source)更新版本源码位置使用被使用 wp-includes/comment-template.php:32610...

日期:2020-08-10 23:06:14 浏览:924

network_admin_edit_{$_GET[‘action’]}

do_action( "network_admin_edit_{$_GET[‘action’]}" )操作挂钩:启动请求的处理程序操作。Action Hook: Fires the requested handler action.目录锚点:#说明#源码说明(Description)钩子名称的动态部分$u GET['action']引用请求的操作的名称。源码(Source)更新版本源码位置使用被使用3.1.0 wp-admin/network/edit.php:3600...

日期:2020-08-02 09:56:09 浏览:869

network_sites_updated_message_{$_GET[‘updated’]}

apply_filters( "network_sites_updated_message_{$_GET[‘updated’]}", string $msg )筛选器挂钩:在网络管理中筛选特定的非默认站点更新消息。Filter Hook: Filters a specific, non-default site-updated message in the Network admin.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分$_GET['updated']引用了非默认的...

日期:2020-08-02 09:56:03 浏览:854

pre_wp_is_site_initialized

过滤器::过滤在访问数据库之前是否初始化站点的检查。Filter Hook: Filters the check for whether a site is initialized before the database is accessed.目录锚点:#源码源码(Source)更新版本源码位置使用被使用 wp-includes/ms-site.php:93910...

日期:2020-07-29 10:15:38 浏览:825

WordPress 的SEO 教学:如何在网站中加入关键字(Meta Keywords)与Meta 描述(Meta Description)?

你想在WordPress 中添加关键字和meta 描述吗?关键字和meta 描述使你能够提高网站的SEO。在本文中,我们将向你展示如何在WordPress 中正确添加关键字和meta 描述。为什么要在WordPress 中添加关键字和Meta 描述?关键字和说明让搜寻引擎更了解您的帖子和页面的内容。关键词是人们寻找您发布的内容时,可能会搜索的重要词语或片语。而Meta Description则是对你的页面和文章的简要描述。如果你想要了解更多关于中继标签的资讯,可以参考Google的说明。Meta 关键字和描...

日期:2020-10-03 21:18:25 浏览:1688

谷歌的SEO是什么

SEO (Search Engine Optimization)中文是搜寻引擎最佳化,意思近于「关键字自然排序」、「网站排名优化」。简言之,SEO是以搜索引擎(如Google、Bing)为曝光媒体的行销手法。例如搜寻「wordpress教学」,会看到本站的「WordPress教学:12个课程…」排行Google第一:关键字:wordpress教学、wordpress课程…若搜寻「网站架设」,则会看到另一个网页排名第1:关键字:网站架设、架站…以上两个网页,每月从搜寻引擎导入自然流量,达2万4千:每月「有机搜...

日期:2020-10-30 17:23:57 浏览:1294