I’m using pio in vscode on windows. I went to the libraries section of pio home and installed TelnetStream. I included it in my main.cpp using #include <TelnetStream.h>. Compiling failed with header file not found. Then I tried #include "TelnetStream.h" and it also failed.
So then I added lib_deps = https://github.com/jandrassy/TelnetStream to platformio.ini and it compiled ok. But I still have a problem. VSCode is still showing the header file is missing with a red line under the code.
How do I fix this and why didn’t the normal PIO install work?
This is because a reference to the library has to be first added to the project (via an #include statement), and then the project has to be either built or a Ctrl+Shift+P → Rebuild IntelliSense must be executed. This is because the library dependency finder will only add the used libraries to the include path, and at the time of adding the library to the project, there is no reference to in the code. This is the way the LDF works.
You see after I execte a Ctrl+Shift+P → Rebuild IntelliSense