超详细教程:windows安装MSYS2(mingw && gcc)——更新于2021.11

目录

  • 安装

MSYS2官网:https://www.msys2.org/

安装

  1. 下载安装程序(官网首页有):msys2-x86_64-20210725.exe 或 CSDN:https://download.csdn.net/download/ymzhu385/45988277
  2. 运行安装程序。MSYS2 需要 64 位 Windows 7 或更新版本。
  3. 输入所需的安装路径(NTFS 卷上的仅 ASCII 短路径,不能有重音、空格、符号链接、 subst、网络驱动器、 FAT)。超详细教程:windows安装MSYS2(mingw && gcc)——更新于2021.11_第1张图片
  4. 完成后,勾选Run MSYS2 now
    超详细教程:windows安装MSYS2(mingw && gcc)——更新于2021.11_第2张图片
  5. 更新包数据库和基础包。除非您的安装文件是最新的,否则将需要两个步骤。第一次运行pacman -Syu
  6. 从开始菜单运行“MSYS2 MSYS”。使用以下命令更新其余基本软件包pacman -Su
  7. 现在 MSYS2 已经为您准备好了。您可能需要安装一些工具和 mingw-w64 GCC 来开始编译pacman -S --needed base-devel mingw-w64-x86_64-toolchain
$ pacman -S --needed base-devel mingw-w64-x86_64-toolchain
warning: file-5.39-2 is up to date -- skipping
[... more warnings ...]
:: There are 48 members in group base-devel:
:: Repository msys
   1) asciidoc  2) autoconf  3) autoconf2.13  4) autogen
   [... more packages listed ...]

Enter a selection (default=all):
:: There are 19 members in group mingw-w64-x86_64-toolchain:
:: Repository mingw64
   1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git
   [... more packages listed ...]

Enter a selection (default=all):
resolving dependencies...
looking for conflicting packages...

Packages (123) docbook-xml-4.5-2  docbook-xsl-1.79.2-1
               [... more packages listed ...]
               m4-1.4.18-2  make-4.3-1  man-db-2.9.3-1
               mingw-w64-x86_64-binutils-2.35.1-3
               mingw-w64-x86_64-crt-git-9.0.0.6090.ad98746a-1
               mingw-w64-x86_64-gcc-10.2.0-6
               mingw-w64-x86_64-gcc-ada-10.2.0-6
               mingw-w64-x86_64-gcc-fortran-10.2.0-6
               mingw-w64-x86_64-gcc-libgfortran-10.2.0-6
               mingw-w64-x86_64-gcc-libs-10.2.0-6
               mingw-w64-x86_64-gcc-objc-10.2.0-6
               mingw-w64-x86_64-gdb-10.1-2
               mingw-w64-x86_64-gdb-multiarch-10.1-2
              [... more packages listed ...]

Total Download Size:    196.15 MiB
Total Installed Size:  1254.96 MiB

:: Proceed with installation? [Y/n]
[... downloading and installation continues ...]
  1. 要使用 mingw-w64 GCC 开始构建,请关闭此窗口并从“开始”菜单运行“MSYS MinGW 64 位”。现在您可以调用makegcc构建适用于 Windows 的软件。(也可以添加环境变量,路径path = C:\msys64\mingw64\bin
  2. 验证:
$ gcc --version
gcc (Rev2, Built by MSYS2 project) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

你可能感兴趣的:(java,c++,c语言)