How to use different lib versions with same name in one project?


I want to use two different versions of one library in one project.
The libs are:
official FastLED: PlatformIO Registry
inofficial Fork for RGBW: GitHub - coryking/FastLED: The main FastLED library (successor to FastSPI_LED). Please direct questions/requests for advice to the g+ community - - we'd like to keep issues to just tracking bugs/enhancements/tasks. *NOTE* library work is currently on hold - see for details.

I defined different enviroments like this:

lib_deps =

lib_deps =
  1. I hoped the alternative library would be installed to .piolibdeps\FastLED_RGBW\ instead of .piolibdeps\FastLED\
  2. But even if it did, I think #include <FastLED.h> would still call the official library, right?

I would like to use something like this:

build_flags = -D RGBW
lib_deps =
#ifdef RGBW
   #include <FastLED_RGBW/FastLED.h>
  #include <FastLED.h>

So, how do I do this the right way?
Or do I have to use different project folders where only one FastLED exists?

1 Like

lib_extra_dirs is the config option you want.

Don’t use the ‘lib’ dir. Make lib1, lib2, … in your project folder. Under your board settings use ‘lib_extra_dir = lib1’ and so on.

This is a bug and has been just fixed

1 Like