Description
I am compiling for ARM embedded with arm-none-eabi using coc.nvim with Vim 9.1.
Trying to use std::array
gives me the error no template named 'array' in namespace 'std' (ccls 2)
. I have included the correct header file before the usage and using COC's go to definition takes me to the correct version i.e. the arm-none-eabi file.
My COC setup is as follows:
{
"inlayHint.enable": false,
"workspace.rootPatterns": [
".cocws"
],
"workspace.workspaceFolderCheckCwd": true,
"workspace.bottomUpFiletypes": [
"*.cpp",
"*.h"
],
"languageserver": {
"ccls": {
"command": "ccls",
"filetypes": ["c", "cpp", "h", "hpp"],
"rootPatterns": [".cocws", "compile_commands.json", ".vim"],
"initializationOptions": {
"cache": {
"directory": ".ccls-cache"
},
"client": {
"snippetSupport": true
},
"clang": {
"extraArgs": [
"--gcc-toolchain=/opt/gcc-arm-none-eabi-10.3-2021.10/",
"-isystem/opt/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include",
"-isystem/opt/gcc-arm-none-eabi-10.3-2021.10/arm-none-eabi/include/c++/10.3.1"
]
}
}
}
}
}
As you can see, I have provided the correct compiler path with --gcc-toolchain
and -isystem
. This is how I got COC to find the correct header file. The header file itself clearly defines the templated array struct. Importantly, this code does compile correctly and I am using the compile commands generated with bear make
. The problem is only with the language server.
It is possible that this is an error on my part. Perhaps there is a command line option in the compile commands which is not supported by clang. Any help would be greatly appreciated.