I'm using nvim 0.11.1 in a lsp config, and got clangd installed via mason.
The project I'm working on uses the picoSDK, and clangd works inside nvim.
The problem is, that it can't seem to find the lib containing "vector", since it throws an error at #include <vector>
stating "clang: 'vector' file not found [pp_file_not_found]"
.
Edit: I just saw that clangd also tells me In included file: 'cassert' file not found
when I try to #include "hardware/pio.h"
.
The project is being build via CMakeLists.txt
, and generates a compile_commands.json
which I linked to the root directory of the project. The project compiles just fine and generates a uf2 file that works. So I guess it is "just" a problem with clangd.
I tried to fix this by adding a a config file .config/clangd/config.yaml
which contains:
CompileFlags:
Add:
[
"-I/usr/lib/gcc/arm-none-eabi/14.2.0/include",
"-I/usr/lib/gcc/arm-none-eabi/14.2.0/include-fixed",
"-I/usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/include",
"-I/home/USERNAME/Documents/pico/pico-sdk",
"-I/home/USERNAME/Documents/pico/pico-sdk/src/common/pico_base/include",
"-I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_clocks/",
"-I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_gpio/include",
"-I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_pio/include",
"-isystem /usr/lib/clang/17/include",
"-isystem /usr/include",
"-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1",
"-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/x86_64-pc-linux-gn",
"-isystem /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/backward",
"-isystem /usr/lib/clang/19/include",
"-isystem /usr/local/include",
"-isystem /usr/include",
"-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1",
"-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/x86_64-pc-linux-gnu",
"-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../include/c++/14.2.1/backward",
"-isystem /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/include",
"-I/home/USERNAME/SEQ_PROJECT/seq_fugen/include",
"-I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_pio/include",
]
As stated above, clangd recognized the include folders of the project containing the header files, but throws errors when including vector. I'm working on 6.14.4-arch1-2 and got the following installed via pacman:
arduino-avr-core 1.8.6-1
arm-none-eabi-gcc 14.2.0-1
avr-gcc 14.2.0-1
gcc 15.1.1+r7+gf36ec88aa85a-1
gcc-libs 15.1.1+r7+gf36ec88aa85a-1
gcc14-libs 14.2.1+r753+g1cd744a6828f-1
lib32-gcc-libs 15.1.1+r7+gf36ec88aa85a-1
bear 3.1.5-12
clang 19.1.7-2
clang18 18.1.8-2
I'm out of options to try. Has anybody an idea on how to solve this?
CompileFlags:
Add:
- --target=arm-none-eabi
- --sysroot=/usr/arm-none-eabi
- -I/home/USERNAME/SEQ_PROJECT/seq_fugen/include
- -I/home/USERNAME/Documents/pico/pico-sdk
- -I/home/USERNAME/Documents/pico/pico-sdk/src/common/pico_base/include
- -I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_clocks
- -I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_gpio/include
- -I/home/USERNAME/Documents/pico/pico-sdk/src/rp2_common/hardware_pio/include
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/include
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/include-fixed
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/include
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/include/c++/14.2.0
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/include/c++/14.2.0/arm-none-eabi
- -I/usr/lib/gcc/arm-none-eabi/14.2.0/../../../../arm-none-eabi/include/c++/14.2.0/backward
- -mcpu=cortex-m0plus
- -mthumb
- -std=c++17
- -Wall
- -Wextra
- -Wno-volatile
I'm not sure if this really solves the problem but using this .clangd works for me (at least for the moment and removes the errors.
Maybe that helps anybody reading this question.