Local library precedence over global

Lately installed and using PIO with VSCode.
Having a problem with libraries.
I had installed a library (WiFiManager.h) in the arduino IDE folder.
I have also installed the same library in my project’s /lib folder and made some changes to the .h and .cpp files.
When running compiler in PIO, it is picking up and using files in the arduino folder.
Shouldn’t be the other way around? that is local /lib folder have a higher priority over other folders?
Workaround for now is removing library from arduino folder - which is not a permanent solution.
Cheers.

What’s your exact platformio.ini? Do you use a lib_dirs directive to point it to your Arduino IDE libraries?

What a swift reply!
platformio, nothing fancy, only com speeds and ports added:

[env:esp01_1m]
platform = espressif8266
lib_extra_dirs = ~/Documents/Arduino/libraries
board = esp01_1m
framework = arduino
upload_port = COM[5]
upload_speed = 115200
monitor_speed = 115200
monitor_port = COM5
board_build.f_cpu = 80000000L
board_build.flash_mode = dout
upload_resetmethod = ck

I think @ivankravets can answer best how it’s decided which library to use when it’s found in multiple places (lib_extra_dirs, lib/, global storage,…)

1 Like

I agree with you,
Regards

See Library Dependency Finder (LDF) — PlatformIO latest documentation

If you need to increase priority for project “lib” folder just add it to “lib_extra_dirs” before Arduino libs

You are great, so simple, should have thought of it myself, congrats on your work.
Regards

1 Like