Port Arduino to PlatformIO

I'm porting an Arduino project to PlatformIO; and that turns out to be not so easy as I expected to.
In PlatformIO I want this structure:
Some_Work_Space
|
|--- Procject_1
|
|--- Project_2
|
|--- Common
| |
| |--- Library

How do I tell PlatformIO that I want Project_1 and Project_2 to use libraries from /Common/Library?
On the PlatformIO forum I get the advice to use: "lib_extra_dirs".
All nice and well, but when I read the "documentation" I completely lost track. This "documentation" is written from the perspective of the developer and for him it is a good reference book, but IMHO not very useful for a newbe user.
So, can/will someone help me out please?

Inside the project platformio.ini file, add the line

lib_extra_dirs = path/to/your/library/folder

Thank you, that is quite simple, but...
How can I use a relative path?

I've read something about:

lib_extra_dirs = ${PROJECT_DIR}\..\librairies

Do I have to define "PROJECT_DIR" somewhere?
Or is that a system global?

No, just use relative addressing
For example with a tree like this

  • projectFolder1
    • platformio.ini
  • projectFolder2
    • platformio.ini
  • libs_folder
    • Library1
    • OtherLibrary

you would use in both platformio.ini files
lib_extra_dirs = ../libs_folder

I have:

projectFolder1
platformio.ini

projectFolder2
src
main.cpp
platformio.ini

common
wificonfig
wificonfig.h
wificonfig.cpp

In main.cpp:
#include <Arduino.h>
#include <WiFi.h> // Requires raw HTTP connection
#include <VS1053.h> // GitHub - baldram/ESP_VS1053_Library: A library for VS1053 MP3 Codec Breakout adapted for Espressif ESP8266 and ESP32 boards.
#include <wificonfig.h> // WiFi user settings

In projectFolder2/platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

lib_deps = ESP_VS1053_Library

lib_extra_dirs = ../common

And still those hated sqiggely line under: "#include <wificonfig.h>""

What am I doing wrong/not at all?

I also closed and opened VSCode/PlatformIO

When I look at the compiler output all seems well, despite those squiggly lines.
Is that a bug in PlatformIO?
LDF: Library Dependency Finder -> Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 31 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP_VS1053_Library> 1.1.2
| |-- 1.0
|-- 1.0
|--<wificonfig
|--<wireconfig
Building in release mode

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.