PlatformIO Community

Although I added the path for a custom library in the platform.ini file under lib_extra_dirs I still get the error message src/main.cpp:4:10: fatal error: Actuator.h: No such file or directory

Although I added the path for a custom library in the platform.ini file under lib_extra_dirs I still get the error message src/main.cpp:4:10: fatal error: Actuator.h: No such file or directory.

Here is the platformio.ini file content:

platform = atmelsam
board = due
framework = arduino

; additional library directories
lib_extra_dirs = 

; Serial Monitor options
monitor_speed = 
monitor_filters = 
monitor_flags = 

You don’t specify the path where one particular library is stored, but the folder which contains all the library folders. Just reduce the path to /Users/omaralamoudi/Dropbox/Arduino/libraries/ and retry.

Note also that global libraries are considered dangerous because you include everything in that folder, which might give false matches to the libraries you actually want. Explicit dependency management using lib_deps (docs) and the registery the is to be preferred here.

I looked over your recommendation, but I can’t seem to find how to add a local library as a lib_deps.

Would you please provide additional guidance?

Thanks @maxgerhardt


  • copy the library folder into the lib/ folder of the project
  • use lib_extra_dirs but the target library should be the only library in the folder to avoid the adverse effects mentioned above
  • try lib_deps = Actuator=<path> form? (it might accept the file:// ‘protocol’ too, instead of https:// and the like.
  • So I don’t want to copy the library because I’m still working on it, and I want to maintain a central copy of it.
  • I tried the following for lib_dps but none worked. I’m using macOS by the way.
lib_dips = 
lib_dips = 
lib_dips = 

The <> are meant as placeholders, not literally. Have you tried

lib_deps = 


haha, sorry pal!

Did not work

Works for me. Maybe retry with file:///Users/omaralamoudi/Dropbox/Arduino/libraries/Actuator (the double-/ are from the file protcol and then / means root of FS)

I have a C:\Users\Maxi\Desktop\test_lib with the contents test.h and test.cpp

#ifndef TEST_H
#define TEST_H

void test_me(); 

#include "test.h"
#include <Arduino.h>
void test_me() {

And using the platformio.ini

[env:Arduino Nano 16MHz]
platform = atmelavr
board = nanoatmega328
framework = arduino
monitor_speed = 57600
lib_deps = 

with code

#include <Arduino.h>
#include <test.h>

void setup() {

void loop() {}


Processing Arduino Nano 16MHz (platform: atmelavr; board: nanoatmega328; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Atmel AVR (2.2.0) > Arduino Nano ATmega328
DEBUG: Current (simavr) On-board (simavr)
 - framework-arduino-avr 5.0.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing file://C:\Users\Maxi\Desktop\test_lib
Library Manager: test_lib @ 0.0.0+20201014210041 has been installed!
Found 10 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <test_lib> 0.0.0+20201014210041
RAM:   [          ]   0.4% (used 9 bytes from 2048 bytes)
Flash: [          ]   1.4% (used 444 bytes from 30720 bytes)
============================= [SUCCESS] Took 2.75 seconds =============================

However that also has the negative side-effective that the library is installed locally in the project under .pio\libdeps\<environment> now and it’s again non-centralized. (Which is a desirable end-result in project management, but only in the end).

So you should just stick with lib_extra_dirs for now.

I am using a Mac with macOS, I see that you are using Windows.

Anyway, I tired again, still doesn’t work. So I’ll stick to the lib_extra_dirs approach for now.

Thank you for your help!