PlatformIO Community

Installed Library not found when included?

I’m quite new to PlatformIO and VSCode, although have quite a bit of experience with coding. I am however stumped as to why VSCode seems to think my libraries do not exist.
My code works fine with the IDE, so its just a PlatformIO/VSCode setup issue.

I’ve setup a Wemos D1 Mini project with my ini file looking like so:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino

The 2 libraries that are giving me errors are FirebaseESP8266.h and SSD1306Wire.h

#include <Arduino.h>
#include "FirebaseESP8266.h"
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include <Servo.h>
#include "SSD1306Wire.h"

For Firebase, I have gone to PIO Home and installed the lib to my project. Is there anything more I need to do here, or should this just be working?

If I try to compile it, it says src\main.cpp:2:29: fatal error: FirebaseESP8266.h: No such file or directory

Check your platformio.ini, and add

lib_deps =
   Firebase ESP8266 Client
   ESP8266_SSD1306

to it if not present, assuming I got the right libraries. It seems that installing a library to a project is currently not working properly.

1 Like

Ah thanks. That’s done it.

I assume that when you install a library to a project, it should automatically add to the lib_deps for you under normal circumstances?

1 Like

That’s what I would have expected to happen. To be honest, I hadn’t tried installing a library via PIO home that way before… I always just put the lib_deps entries in manually. It seems pretty pointless to have the project install option though if it a) doesn’t add to the lib_deps entry and b) doesn’t install the library to the project library cache folder.

1 Like

I’ve just filed a bug report so this can be looked into.

2 Likes

I believe using PIO Home to install project library should just save it to the {projectname}\.pio\libdeps\esp01_1m\{libraryname} folder (if it was working) which will then be automatically included. No need to add it to lib_deps. lib_deps is used to automatically grab the library for you.

1 Like

Yup, that’s what I expected also. I still would have liked it to have an option to add to the lib_deps automatically, as that saves the need to manual install to project if you’ve moved to a different computer, etc, either way, it’s currently not doing the core job of actually installing to the right place! :laughing: :man_facepalming:

Actually you can if you use the terminal to do it;
platformio lib install {library} --save

1 Like

lol… true… thanks for reminding me of that… I forgot that option was added… mainly since I ‘install’ libraries via the lib_deps entry. :slight_smile: I was thinking more along the lines of a checkbox in the GUI for when installing that way.

1 Like

This is a known bug and was fixed in the latest PlatformIO Core 4.2.2-dev version. Please switch to development version of PIO Core => https://docs.platformio.org/en/latest/ide/vscode.html#platformio-ide-usedevelopmentpiocore platformio-ide.useDevelopmentPIOCore: true or use lib_deps as described above.

1 Like

Confirmed working with 4.2.2a3

2 Likes