How to add new folder to build?

example,i want to add new folder beside SRC

|--src
|--mynewfolder
|  |--gui
|  |  |--custom
|  |  |  |- Bar.c
|  |  |  |- Bar.h
|  |  |--generated
|  |  |  |- Bar2.c
|  |  |  |- Bar2.h

and
i write in src/main.cpp

#include "Bar.h"
#include "Bar2.h"

build it error
src\main.cpp:11:24: fatal error: Bar.h: No such file or directory

my platformio.ini add

include_dir=
	./include
	./mynewfolder/gui/custom
    ./mynewfolder/gui/generated


src_dir =
    ./src
    ./mynewfolder/gui/custom
    ./mynewfolder/gui/generated

I need your help,thanks!

No that’s the wrong way, include_dir etc. is the include folder (a single one) for the project, by default, include/.

With the above folder structure you have, the folder gui/ gets added to the include path, and so if you want to include Bar.h, you have to do it via #include <custom/Bar.h>. Of course, in this case you would just use a library.json file in the gui folder to automatically add custom and generated to the include path.

Your question is very similiar to Include Path Problems.