windows11+gcc安装-good

发布时间 2023-06-27 17:03:02作者: 风中狂笑

MSYS2

安装之后,在msys的terminal中执行,可以去安装目录下寻找

 

>pacman -S mingw-w64-ucrt-x86_64-gcc

 

 Get Started with C++ and Mingw-w64 in Visual Studio Code

>pacman -S --needed base-devel mingw-w64-x86_64-toolchain

选择默认参数(直接回车即可),会执行一系列的安装

会执行一系列的安装,比如

 

 

  Install the Mingw-w64 toolchain (pacman -S --needed base-devel mingw-w64-x86_64-toolchain). Run the pacman command in a MSYS2 terminal. Accept the default to install all the members in the toolchain group.

  1. Add the path to your Mingw-w64 bin folder to the Windows PATH environment variable by using the following steps:

    1. In the Windows search bar, type 'settings' to open your Windows Settings.
    2. Search for Edit environment variables for your account.
    3. Choose the Path variable in your User variables and then select Edit.
    4. Select New and add the Mingw-w64 destination folder path to the system path. The exact path depends on which version of Mingw-w64 you have installed and where you installed it. If you used the settings above to install Mingw-w64, then add this to the path: C:\msys64\mingw64\bin.
    5. Select OK to save the updated PATH. You will need to reopen any console windows for the new PATH location to be available.
    6.  

Check your MinGW installation

To check that your Mingw-w64 tools are correctly installed and available, open a new Command Prompt and type:

gcc --version
g++ --version
gdb --version

重启后,在cmd的terminal中

 

在powershell中

 but in mysys2 terminal