Can't get lib_extra_dirs to work

I am trying to move some files out into folders that I can share with other apps. I can’t get lib_extra_dirs to work.

I added
lib_extra_dirs = /Users/paul/Documents/PlatformIO/Projects/Madsys
to my plaformio.ini by none of the .cpp files in there get compiled.

My structure is
| /180228-122544-teensy36
| /src
| | main.cpp
| /lib
| platform.ini
| /Madsys
| /Song
| | | Song.h
| | | Song.cpp

I added
build_flags = (…) -I/Users/Paul/Documents/PlatformIO/Projects/Madsys
and the include files work fine.

Everything builds if the Song/ folder is right next to main.cpp

-I~/Documents/PlatformIO/Projects/Madsys broke the includes BTW. This is under OSX High Sierra.

I have reviewed the documentation several times and still can’t get this to work, so any help would be appreciated. I have spend hours on this. Something is wrong or missing from the documentation.

Everything builds fine until I move
| Song.h
| Song.cpp

from my src/ folder to the folder pointed to by lib_extra_dirs. Then the .cpp file is not compiled.

Here is my platform.ini before

; PlatformIO Project Configuration File
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
; Please visit documentation for the other options and examples
; Redirecting...

platform = teensy
board = teensy36
framework = arduino
#lib_deps = USBMIDI
#build_flags = -D USB_MIDI
build_flags = -D LUA_32BITS -D HAVE_PTHREAD_H -D _POSIX_THREADS -fexceptions -I/Users/Paul/Documents/PlatformIO/Projects/Madsys
lib_extra_dirs = /Users/paul/Documents/PlatformIO/Projects/Madsys

-Idir ← Add the directory dir to the head of the list of directories to be searched for header files

The files are here after moving them:

xxxx$ ls /Users/paul/Documents/PlatformIO/Projects/Madsys/Song
Song.cpp Song.h

Same problem here, did you find a solution for this problem?

What’s your setup for reproduction?

1 Like