pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

newlib not included in compile_commands.json for some files

Open ast opened this issue 1 year ago • 6 comments

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)

ast avatar Jan 12 '24 10:01 ast

Why is your pico project using /usr/include/newlib?

peterharperuk avatar Jan 12 '24 12:01 peterharperuk

It's the standard C library used by pico-sdk.

For some reason Ubuntu installs the headers there. Is there a better way?

ast avatar Jan 12 '24 13:01 ast

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)

vulpes2 avatar Feb 08 '24 17:02 vulpes2