How do I include a file in the src directory from a file in the lib directory?

How do I include a file in the src directory from a file in the lib directory? For example:

lib/thelibrary/thefile.cpp:

#include "config.h"
int something[SOME_CONSTANT];

src/config.h:

#define SOME_CONSTANT 32

The error message says it can’t find config.h. I also tried “…/…/src/config.h”.

Thanks for your help :slight_smile:

Hi @jordanapplewhite!
How about adding special build_flags option to your platformio.ini:

[env:your_env]
platform = your_platform
framework = your_framework
board = your_board
build_flags = -I$PROJECTSRC_DIR 
1 Like