PlatformIO Community

Using Existing Arduino libraries in place

Is there a method in platformio of including all the arduino libraries and core libraries that are already in place from the arduino ide installation so that platformio can find them? Moving a simple program that contains a single #include <Keyboard.h> leads to so many failed dependencies that it is nearly impossible to quickly test something by moving it from the arduino’s ide to platformio/vscode.

Do you mean use existing libraries from an Arduino IDE install?

The lib_extra_dirs platformio.ini option should do the trick… just point it to your Arduino IDE libraries folder.

1 Like

Hello pfeerick,
Yes, I’m familiar with lib_extra_dirs in platformio.ini. My problem seems a bit more complicated…an example might help describe it…

A simple program with the line #include <Keyboard.h> compiles fine in Arduino’s IDE.

Move that same program to Platformio/vscode, and now I have several “can’t find Keyboard.h, etc…”. So I track down Keyboard.h’s library in the Arduino’s libraries, and include that in platformio’s lib_extra_dirs.

Now I have all type of “can’t find hid.h” missing files. So I manually track those down and do the same, adding the libraries to lib_extra_dirs again.

Then I have many "can’t find pluggableusb.h references and others…this process seems endless, and Arduino’s libraries are is several different places (Base, core, hardware, platform, etc?).

Ideally, there would be one single lib_extra_dirs that I could add at the root of my arduino installation that would solve this in platformio, but including the base of my arduino like that didn’t seem to help.

Alternately, a manner in platformio of “listing” every reference that is missing, but I suspect that that is impossible since if it can’t find a file, it cannot look into that file to see what is missing further up the hierarchy of prerequisites.
…or is there some better method of doing this messy process that what I am doing? In the future I’d like to keep all these third-party located libraries within my project to keep it portable, but I can’t seem to find a good method of tracking and finding them. Any other suggestions?

have same problem , any answer seems NOT POSSIBLE …

a) what arduino libraries to share with platform-IO ( is arduino-ide internal!)
B) how to force PlatformIO to liik for specific places , to find
the INCLUDES and libraries intended for question a

it is clear to me that lib_extra_dirs is not enough Nor does it work

PLease someone answer
of is there NOONE USING PLATFORM IO for the above reason !!!

Hi @dreuzel, could you please provide more details about what you’re trying to achieve?
I understand that you’d like to use Arduino libraries which are installed in Arduino IDE folders? Which ones? Can you post your project (or a minimal one which shows the problem)?

I do use PlatformIO IDE, but I use the libraries from the framework installed in PlatformIO IDE itself, the libraries installed inside the project by library manager, or the libraries which I copy to my project manually inside lib subfolder. So far so good.

1 Like

Hi @Sam, if I understand correctly, you have some libraries already installed in Arduino IDE and you’d like to import them to PlatformIO, so that they’re available for your projects?