clang-cl /Zi main.cpp /link /DEBUG Then load into WinDbg. Visual Studio generator + Clang cmake -G "Visual Studio 17 2022" -A x64 -T ClangCL .. This sets clang-cl.exe as the compiler. Ninja generator (explicit Clang) cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. Add -DCMAKE_CXX_FLAGS="--target=x86_64-pc-windows-msvc" if needed. Toolchain file for MSVC environment windows_msvc_toolchain.cmake :
Example with clang-cl:
clang -fuse-ld=lld main.cpp | Flag | Runtime | |-------|---------| | /MD | Dynamic MSVC runtime (msvcp140.dll, vcruntime140.dll) | | /MT | Static MSVC runtime | | /MDd | Dynamic debug runtime | | /MTd | Static debug runtime | clang on windows