"/usr/bin/clang++" is not able to compile a simple test program

I try change CLion toolchain from GCC to Clang. I have install clang.
Is error:

CMake Error at /home/andrzej/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/share/cmake-3.26/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/andrzej/wazne/gitmy/qt-textviewer/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-ZgHnsL
    
    Run Build Command(s):/home/andrzej/.local/share/JetBrains/Toolbox/apps/clion/bin/ninja/linux/x64/ninja -v cmTC_d4193 && [1/2] /usr/bin/clang++   -fcolor-diagnostics -MD -MT CMakeFiles/cmTC_d4193.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_d4193.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_d4193.dir/testCXXCompiler.cxx.o -c /home/andrzej/wazne/gitmy/qt-textviewer/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-ZgHnsL/testCXXCompiler.cxx
    [2/2] : && /usr/bin/clang++   CMakeFiles/cmTC_d4193.dir/testCXXCompiler.cxx.o -o cmTC_d4193   && :
    FAILED: cmTC_d4193 
    : && /usr/bin/clang++   CMakeFiles/cmTC_d4193.dir/testCXXCompiler.cxx.o -o cmTC_d4193   && :
    /usr/bin/ld: cannot find -lstdc++: No such file or directory
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

especially
cannot find -lstdc++ whereas is installed with Gcc.
Maybe error because of /usr/bin/ld instead of lld?

==================

Solution: I have installed g+±12

Linux systems, which I assume this is, use the GNU libstdc++ as their system C++ standard library implementation, rather than LLVM’s libc++. When you install Clang you get just the compiler but not this standard library. On some OSes (e.g. Debian) the “clang” package depends on the “libstdc++-dev” package (well, a specific version thereof) and so you don’t need to worry about it, but if you’re on another OS then perhaps they don’t do that and instead you need to install it yourself. Installing g++-12 would have resolved it by virtue of pulling in libstdc++-dev, I imagine.

I second this.

This is how build system and installation is wired. You need to make sure libstdc++ is present on the system. Installing LLVM via Cmake will not pull in libstdc++. If you are installing from packages then some distros do have dependency on gcc and thus libstdc++ is pulled in.