I encountered a question when I tried to config neovim with clangd for c&cpp programming on Windows 11. The softwares and platform used are list below:

  • Windows 11
  • Neovim 0.10.0
  • llvm-mingw 20240417
  • cmake 3.29

I have created hello_world.cpp file to test the clangd configuration. The file could be build by clang with no error. When viewed with neovim, there is a error in the iostream header file which say "In included file: 'vcruntime_exception.h" file not found". There is no 'vcruntime_exception.h' on my machine.

enter image description here

When I added the option '-fno-ms-extensions' into the .clangd file, the error change to 'In included file : no member named 'value' in 'std::is_trivial' and 'In template : no member named 'value' in std::is_standard_layout<...' enter image description here

The clangd configuration in lsp and compile flags in .clangd are listed below:

            ["clangd"] = function()
                    -- on_attach = function (client, bufnr)
                    --   client.server_capabilities.signatureHelpProvider = false
                    --   on_attach(client, bufnr)
                    -- end,
                    capabilities = capabilities,
                    -- cmd = {
                    --  "clangd",
                    --  "--log=verbose",
                    --  -- "--query-driver=C:/Users/onebot/scoop/apps/llvm-mingw/current/bin/g++.exe",
                    -- },
                    -- filetypes = {
                    --  "c",
                    --  "cpp",
                    -- },
  Add: [ 
    # -std=c++17,
    # -stdlib=mingw,
    # - "-fms-extensions"
    # -fno-ms-compatibility,
    # -fno-ms-extensions,

I want to correct these errors, but I don't know how to do as a newbie in neovim and clangd.

  • Did you use CMake to create a compile_commands.json as explained in clangd's docs?
    – Friedrich
    Commented Jun 5 at 4:46
  • Welcome to Vim! Maybe could you add the code of your cpp function to the question. It would ease the reproduction of your problem and make it less error prone :-) Commented Jun 5 at 7:36
  • Anyway, it's a clangd configuration problem, not a Vim problem. I voted to close as off-topic. Resources on how to get clangd working should be readily available.
    – Friedrich
    Commented Jun 5 at 8:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.