Help: Platformio libraries for Dummies

I have installed and subscribed Platformio around 6 months ago and did some programming on esp32 already running. As my level of knowledge about programming and ability to manage low-level applications, it was a nightmare to put platformio running as I was always getting tonnes of errors related with the installation and libraries but finally I was able to flash my esp32.

Now I need again to use Platformio with a ESp32/LoRa sketch and again errors related with libraries are back and, after several wasted days, Iā€™m stuck with very simple projects because Iā€™m not being able to Built any code requiring libraries that I think are already installed.

To overcome the errors, seems now I have installed so many libraries that Iā€™m getting errors saying they are in conflict and my knowledge about platformio is not enough to understand the error messages (dependency?? what you mean? ).

My help request, before giving up platformio, is if there are any site, movie or document FOR DUMMIES to learn how to manage libraries in platformio? How can I clean all libraries already installed and start it from zero?

You help would be appreciated.

Iā€™m not sure about any videos or guides, but if you ask on the forum, youā€™ll usually get all the answers you need :wink:

So, first things first, what integrated development environment (IDE) are you using? VSCode? Atom? Something else?

Either way, it sounds like you basically want to delete any global libraries you might have installed, and then clean out any that are in your project, and start from a clean slate again. Once we know what IDE you have, more specific guidance can be given.

Thanks for your supportive reply :slight_smile:
Iā€™m using VSCode

Ok, my suggestion would be to do the following

  1. Click the platformio alien head icon to get the project tasks panel
  2. Click on libraries in quick access
  3. Click on ā€˜Installedā€™
  4. Click on ā€˜Uninstallā€™ for libraries installed in the project in question, or globally via (global storage will be at the bottom of the list if there are any there).

It is then probably a good idea to then double check in the project folder, use one of mine as an example, tracerWifi (if youā€™re unsure how to bring up the file/workspace panel again, itā€™s the top icon on the sidebar), expand the .piolibdeps and if there is anything listed there, right click on them in turn and delete them.

1 Like

Thanks.
The errors have gone and now Iā€™m only instilling libraries to the projects and not globally.
Iā€™m still trying to understand the cascaded dependency of each library to have all need to be able to build the project phase.

If I install a library locally to a project I still need to declare it on platformio.ini ?

1 Like

I would think notā€¦ if you shove it in /lib I would think it will be available to your project as youā€™ve resolved the dependency manually. If you donā€™t want to do that, you would list the dependency in platformio.ini, and it would automatically download either the latest, or specified version (if a specific version is specified) into /.piolibdeps and manage updates itself (if you just want the latest and greatest at all times).

Thanks for your guidance now is much lower the number of errors I get in my small projects.

However Iā€™m still struggling to understand some of them as the one you can see on print screen.

On left you can see the library Adafruit_Sensor.h was declared but pio stops compiling because ā€œfatal error: Adafruit_Sensor.h: No such file or directoryā€.

What Iā€™m not understanding?

Thanks again for your help

Hmā€¦ not sureā€¦ I just grabbed this example code, made a project for a Arduino Nano (atmega328) - ignore the ā€˜unoā€™ as I changed the board type without changing the environment name, and have the below for the lib_deps (using the library ID numbers I could see on the screenshot), and after adding #include <SPI.h> above the other includes to make radiohead happy, it compiled fine for me. Is the adafruit unified sensor library listed in your platformio lib_deps? Although I donā€™t see why that would be a problem since itā€™s plainly there in the .piolibdeps folderā€¦ and even it it wasnā€™t there now, it has been at some point, and removing it should make it workā€¦ this is just nuts! :confounded: Delete the .pioenv and .piolibdeps and force it to recreate everything.

lib_deps = 
  31
  19
  38
  124