Clang for Clion

MSYS2 + Clion

2026-02-17

Written by: xiaobin

use boost

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)

msys2

C:\msys64\clang64\bin

加到PATH

installation

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

gdb - option

pacman -S mingw-w64-clang-x86_64-gdb

library

pacman -S mingw-w64-x86_64-boost

Clion

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.

Thread model - threads

Exception Handling - exceptions

Debugging With Arbitrary Record Formats

Upgrade MingW bundled with Clion - option

把x86_64-15.2.0-release-posix-seh-ucrt-rt_v13-rev0.7z覆盖到

<CLion-HOME>\bin\mingw

Toolchain

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.

toolchain

toolchain

Ref