pico-sdk
pico-sdk copied to clipboard
newlib not included in compile_commands.json for some files
I generated a cpp project named keyboard with pico-project-generator.
Using cmake 3.27.4 with
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
, to generate a compile_commands.json for use with clangd (in my case with eglot on emacs).
For the file `keyboard.cpp -I/usr/include/newlib is missing, but it's there for other files such is irq_handler_chain.S and most if not all other .S files.
This causes code completion not to work correctly.
I have been unable to find the cause of this, but worked around it using:
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES /usr/include/newlib)
Why is your pico project using /usr/include/newlib?
It's the standard C library used by pico-sdk.
For some reason Ubuntu installs the headers there. Is there a better way?
Just ran into this, on a Fedora system you can set this to make clangd work:
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES /usr/arm-none-eabi/include)