PlatformIO Community

Help: Platformio libraries for Dummies


#1

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.


#2

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.


#3

Thanks for your supportive reply :slight_smile:
I’m using VSCode


#4

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.


#5

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 ?


#6

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).


#7

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


#8

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