问题描述
我的系统中安装了 MSYS2 64 位。 当我尝试检查 gcc 版本时,我得到以下输出。
$ gcc --version
gcc.exe (Rev9,Built by MSYS2 project) 10.2.0
copyright (C) 2020 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.
但我想为使用 qt 库的项目使用特定的 mingw 版本。 当我检查我的 qt 项目的构建日志和安装文件夹时,我发现了这一点。
|Project name: DataManager
|Project version: undefined
|C++ compiler for the host machine: ccache c++ (gcc 4.9.2 "c++ (i686-posix-dwarf-rev1,Built by MinGW-W64 project) 4.9.2")
|C++ linker for the host machine: c++ ld.bfd 2.24
|Program python3 found: YES
|Found qmake: C:\Qt\5.6.3\mingw49_32\bin\qmake.EXE (5.6.3)
我假设它使用 mingw49_32 版本和 gcc 版本 4.9.2。 我想在 MSYS2 中使用相同的 gcc 版本 (4.9.2)。
我怎样才能实现它?
解决方法
你不能用 MSYS2 做到这一点。旧包最终会从 MSYS2 存储库中删除,因此即使它在过去的某个时候具有 GCC 4.9,它也不再具有。 earliest available version 是 GCC 9.3。
即使它在存储库中,您也必须手动下载并安装它及其所有依赖项,因为无法直接从 pacman
下载过时的软件包。
但是,我怀疑:
- 您已经在
C:\Qt\5.6.3\mingw49_32\bin
中安装了 GCC 4.9。 - 即使不这样做,您也可以使用最新的 GCC。