MSYS2 + Clion
2026-02-17
Written by: xiaobin
CMakeLists.txt:
cmake_minimum_required(VERSION 4.1)
project(untitled)
set(CMAKE_CXX_STANDARD 20)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(untitled main.cpp)
C:\msys64\clang64\bin
加到PATH
open “MSYS2 CLANG64” from the Start menu.
pacman -S mingw-w64-clang-x86_64-toolchain
pacman -S mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-ninja
pacman -S mingw-w64-clang-x86_64-gdb
pacman -S mingw-w64-x86_64-boost
Clion bundles a version of the MinGW toolset for quick setup. The exact version bundled is MinGW-w64 13.1 with posix threads, and seh exceptions.
Debugging With Arbitrary Record Formats
把x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z覆盖到
<CLion-HOME>\bin\mingw
Go to Settings | Build, Execution, Deployment | Toolchains and create a MinGW toolchain Set the Toolset to C:\msys64\clang64. Set other paths manually in case they are not detected automatically.

