Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7513

SDK • Blink example code Clangd warnings and errors

$
0
0
Hi, I've been setting up my Raspberry Pi 5 (64bit Rasp Pi OS) so i can use it for C/C++ programming on the Pico using the Raspberry Pi Extension in VSCode and I thought I'd also give Clangd a try. On installing the Clangd extension I used the RPi Pico extension to generate the blink example code, with the result that the very first line of blink.c

Code:

#include "pico/stdlib.h"
has both a warning and an error. I have a couple of questions:

1) The warning is

Code:

Included header stdlib.h is not used directly
which as I understand it is because the actual code blink uses is from a header included somewhere in the nested header include matryoshka doll that starts with pico/stdlib.h. From searching around I've figured out that I can get rid of this warning by adding:

Code:

Diagnostics:  UnusedIncludes: None
to config.yaml, and I'm pretty happy to do so since it just appears to be a consequence of the structure of the pico libraries, but I wondered if there was anything I should be aware of from doing this? It seems like the purpose of the warning is to push people to make it clear what is being included and what isn't, rather than including headers that include headers that include headers etc. This seems like probably good practice, but is my Pico code going to suffer from using pico/stdlib.h instead of trawling through for the specific libraries I need? I'm sure blink will cope fine regardless, I mean more substantial projects :)

2) Possibly more significantly, the error is

Code:

In included file: 'assert.h' file not found with <angled> include; use "quotes" instead clang(pp_file_not_found_angled_include_not_fatal)
While it claims to be a fatal error, it does not actually prevent blink from compiling and running on my Pico2. This means I could also just ignore it, but if I'm going to start suppressing and ignoring all the warnings and errors Clangd throws up with the Pico SDK then I might as well not bother using it. Also, I haven't been able to see a way to suppress it like the above warning, so the red error line will always be there which is frustrating. I was wondering if anyone has previously seen this, and if there is a likely solution? I'm confident that I have simply done something foolish or wrong or neglected to do something in setup, though Clangd does seem to give correct scrollover information and I haven't (yet) seen any advice that has helped resolve this when I've looked. Also, since the code compiles and runs, is this simply Clangd being overzealous/trying to enforce a style, or is this an actual issue with the Pico SDK, or is it some third option?

So, tl;dr does anyone else use Clangd with the Pico SDK, have they seen these warnings/errors before, and does anyone have a suggestion for how I can resolve them? Thanks!

Statistics: Posted by MinViableEngineer — Sat Jan 17, 2026 2:56 pm — Replies 7 — Views 78



Viewing all articles
Browse latest Browse all 7513

Trending Articles