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.
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<…’
The clangd configuration in lsp and compile flags in .clangd are listed below:
["clangd"] = function()
lspconfig["clangd"].setup({
-- 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",
-- },
})
end,
:
CompileFlags:
Add: [
# -std=c++17,
# -stdlib=mingw,
# - "-fms-extensions"
# -fno-ms-compatibility,
# -fno-ms-extensions,
-isystem,C:/Users/xxxx/scoop/apps/llvm-mingw/current/include/c++/v1,
-isystem,C:/Users/xxxx/scoop/apps/llvm-mingw/20240417/lib/clang/18/include,
-isystem,C:/Users/xxxx/scoop/apps/llvm-mingw/current/include,
]
I want to correct these errors, but I don’t know how to do as a newbie in neovim and clangd.
I tried to remove the “vcruntime_exception.h” error in neovim with clangd