Hello there!
I’m on Linux, using vim and I use clangd as my language server. The code compiles fine but it always gives me something missing, e.g. Use of undeclared identifyer ‘Serial’ and In included file ‘avr/pgmspace.h’ file not found, among others.
Because of these errors a lot of language server functions dont work.
It really depends on what I use as language server. if I use ccls then the include file error is gone (because of .ccls) but it still does not recognize Serial or digital, among other core functions
If i use clangd same error, along with the error I mentioned in my previous comment
PS: I have modified the env variables to best suit my workflow, I still get the same error even if all pio variables are reset to default
Please open an issue in Issues · platformio/platformio-core · GitHub for that with the exact software / components tha you’re using there. Vim support was previously corrected per this issue but if you say both is broken, it might be in need of another update. All I see is that
is correctly in the include paths where Arduino.h is, which includes all other headers for Serial and digitalWrite() etc. So if your code has a #include <Arduino.h> at the top and it still can’t find the functions, that’s a bug.
it does have the Arduino include. with ccls I get no error on the line #include but I get it everywhere else. with clangd I get the error even on the #include line usually refering to a missing stdlib.h (huh!!!) or some other Atmel header
i could open an issue on git. but did not want to go that route if it was fixable through a forum discussion ad/or it was because i personally overlooked something simple
Well in that folder there should be the file avr/pgmspace.h that it can’t find, although the folder is declared to it in the .ccls file.
This doesn’t look like a error on the user side. This example is so simple and clear that it shouldn’t fail. It failing indiciates that either PlatformIO generates the .ccls file wrongly or something else has a bug. Please open an issue per link above with your project information (platformio.ini + code), error screenshot, and used vim / plugins versions.