Add a folder directory to libraries in PlataformIO [include_dir]

Hello, im trying to organize a code by features on PlatformIO i.e,

— main.cpp
— features
------ DAQ
--------- dataacquisition.h
--------- dataacquisition.cpp
------ packet
--------- packet.h
--------- packet.cpp
— core
------ pinSetup.h

I try to use

include_dir = src/features/DAQ

and it works for this one, but when i try to use both:

include_dir = src/features/DAQ
include_dir = src/features/packet

didnt work, actually i wish i could just make include_dir = scr/, and the compiler scan through all the paths on the src/: features/DAQ, features/packet and core/. Any ideias?

Best Regards

1 Like

You’re using the wrong setting – include_dir is meant so that you can change the default path of the standard include directory, which is the include/ folder in the project. It’s not meant to support multiple directories (“multiple: no” as seen in the docs).

What you seem to want to do is add multiple directories to the include search path. Thas is done with build_flags as documented. It can be either put in every environment or in the [env] section. Example

build_flags =  
   -I src/features/DAQ
   -I src/features/packet

platform = espressif32
board = esp32dev
framework = arduino