环境搭建(CLion,MSVC,MinGW)

安装 msys2

下载地址:https://www.msys2.org/

配置源,修改 /msys64/etc/pacman.d 文件夹如下三个文件

mirrorlist.mingw32

  1. ##
  2. ## 32-bit Mingw-w64 repository mirrorlist
  3. ##
  4. ## Primary
  5. ## Server = https://repo.msys2.org/mingw/i686/
  6. ## Mirrors
  7. ## Server = https://downloads.sourceforge.net/project/msys2/REPOS/MINGW/i686/
  8. ## Server = https://www2.futureware.at/~nickoe/msys2-mirror/mingw/i686/
  9. ## Server = https://mirror.yandex.ru/mirrors/msys2/mingw/i686/
  10. Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/
  11. Server = http://mirrors.ustc.edu.cn/msys2/mingw/i686/
  12. ## Server = http://mirror.bit.edu.cn/msys2/mingw/i686/
  13. ## Server = https://mirror.selfnet.de/msys2/mingw/i686/
  14. ## Server = https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/i686/
  15. ## Server = https://mirror.jmu.edu/pub/msys2/mingw/i686/
  16. ## Server = https://ftp.cc.uoc.gr/mirrors/msys2/mingw/i686/
  17. ## Server = https://ftp.acc.umu.se/mirror/msys2.org/mingw/i686/
  18. ## Server = https://mirrors.piconets.webwerks.in/msys2-mirror/mingw/i686/
  19. ## Server = https://quantum-mirror.hu/mirrors/pub/msys2/mingw/i686/
  20. ## Server = https://mirrors.dotsrc.org/msys2/mingw/i686/
  21. ## Server = https://mirror.ufro.cl/msys2/mingw/i686/
  22. ## Server = https://mirror.clarkson.edu/msys2/mingw/i686/
  23. ## Server = https://ftp.nluug.nl/pub/os/windows/msys2/builds/mingw/i686/
  24. ## Server = https://download.nus.edu.sg/mirror/msys2/mingw/i686/
  25. ## Server = https://ftp.osuosl.org/pub/msys2/mingw/i686/
  26. ## Server = https://fastmirror.pp.ua/msys2/mingw/i686/

mirrorlist.mingw64

  1. ##
  2. ## 64-bit Mingw-w64 repository mirrorlist
  3. ##
  4. ## Primary
  5. ## Server = https://repo.msys2.org/mingw/x86_64/
  6. ## Mirrors
  7. ## Server = https://downloads.sourceforge.net/project/msys2/REPOS/MINGW/x86_64/
  8. ## Server = https://www2.futureware.at/~nickoe/msys2-mirror/mingw/x86_64/
  9. ## Server = https://mirror.yandex.ru/mirrors/msys2/mingw/x86_64/
  10. Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64/
  11. Server = http://mirrors.ustc.edu.cn/msys2/mingw/x86_64/
  12. ## Server = http://mirror.bit.edu.cn/msys2/mingw/x86_64/
  13. ## Server = https://mirror.selfnet.de/msys2/mingw/x86_64/
  14. ## Server = https://mirrors.sjtug.sjtu.edu.cn/msys2/mingw/x86_64/
  15. ## Server = https://mirror.jmu.edu/pub/msys2/mingw/x86_64/
  16. ## Server = https://ftp.cc.uoc.gr/mirrors/msys2/mingw/x86_64/
  17. ## Server = https://ftp.acc.umu.se/mirror/msys2.org/mingw/x86_64/
  18. ## Server = https://mirrors.piconets.webwerks.in/msys2-mirror/mingw/x86_64/
  19. ## Server = https://quantum-mirror.hu/mirrors/pub/msys2/mingw/x86_64/
  20. ## Server = https://mirrors.dotsrc.org/msys2/mingw/x86_64/
  21. ## Server = https://mirror.ufro.cl/msys2/mingw/x86_64/
  22. ## Server = https://mirror.clarkson.edu/msys2/mingw/x86_64/
  23. ## Server = https://ftp.nluug.nl/pub/os/windows/msys2/builds/mingw/x86_64/
  24. ## Server = https://download.nus.edu.sg/mirror/msys2/mingw/x86_64/
  25. ## Server = https://ftp.osuosl.org/pub/msys2/mingw/x86_64/
  26. ## Server = https://fastmirror.pp.ua/msys2/mingw/x86_64/

mirrorlist.msys

  1. ##
  2. ## MSYS2 repository mirrorlist
  3. ##
  4. ## Primary
  5. ## Server = https://repo.msys2.org/msys/$arch/
  6. ## Mirrors
  7. ## Server = https://downloads.sourceforge.net/project/msys2/REPOS/MSYS2/$arch/
  8. ## Server = https://www2.futureware.at/~nickoe/msys2-mirror/msys/$arch/
  9. ## Server = https://mirror.yandex.ru/mirrors/msys2/msys/$arch/
  10. Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch/
  11. Server = http://mirrors.ustc.edu.cn/msys2/msys/$arch/
  12. ## Server = http://mirror.bit.edu.cn/msys2/msys/$arch/
  13. ## Server = https://mirror.selfnet.de/msys2/msys/$arch/
  14. ## Server = https://mirrors.sjtug.sjtu.edu.cn/msys2/msys/$arch/
  15. ## Server = https://mirror.jmu.edu/pub/msys2/msys/$arch/
  16. ## Server = https://ftp.cc.uoc.gr/mirrors/msys2/msys/$arch/
  17. ## Server = https://ftp.acc.umu.se/mirror/msys2.org/msys/$arch/
  18. ## Server = https://mirrors.piconets.webwerks.in/msys2-mirror/msys/$arch/
  19. ## Server = https://quantum-mirror.hu/mirrors/pub/msys2/msys/$arch/
  20. ## Server = https://mirrors.dotsrc.org/msys2/msys/$arch/
  21. ## Server = https://mirror.ufro.cl/msys2/msys/$arch/
  22. ## Server = https://mirror.clarkson.edu/msys2/msys/$arch/
  23. ## Server = https://ftp.nluug.nl/pub/os/windows/msys2/builds/msys/$arch/
  24. ## Server = https://download.nus.edu.sg/mirror/msys2/msys/$arch/
  25. ## Server = https://ftp.osuosl.org/pub/msys2/msys/$arch/
  26. ## Server = https://fastmirror.pp.ua/msys2/msys/$arch/

运行/msys64/msys2.exe

  1. # 类似于Ubuntu update语句
  2. $ pacman -Su
  3. # 安装开发工具
  4. $ pacman -Sy base-devel
  5. # Mingw-w64编译工具
  6. $ pacman -S mingw-w64-x86_64-toolchain

安装 Mingw-w64

下载地址:https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/

添加系统环境变量

image.png

打印验证

image.png

CLion

image.png
image.pngimage.png