PlatformIO Community

How to add a Library with complex structure, and ensure compile every subdirectory

OK, when I add a library which contains many subdir, How should I do to ensure to compile every cpp file, and how to slove the problem about including header path?
For example:
Here the picture is my libray tree view
image
Here the picture is I put the library in the lib dir
image

I can change every #inlcude with relative path to slove the problem, but there are too many files must be modified, this is very waste time.
I think if there is a way to add some option on the platform.ini to slove the problem?

Thank you!

You need library.json — PlatformIO latest documentation

Could you give me some tips, how to write the includeDir?
as the pciture show, I do not how include the file in the library, I do not want to modified evey to make it’s header to the relative path?
Could you do it as a example?
iShot2022-04-18_19.56.36
Thank you!

Have you read this part of the docs? library.json — PlatformIO latest documentation

Screen Shot 2022-04-18 at 15.10.31

includeDir → should be relative, remove / prefix.

And this:

Screen Shot 2022-04-18 at 15.42.14


If you want to work with that library “from the root”, do not override includeDir, it will point to the root by default.

I don’t want to override it, but I do not know how to avoid overriding the includeDir. Should I use another keyword?

Could you give me some examples how to write it if I want to include the dir, I am so stupid and can not understand it well.

I think I find the solution as the link link

Thank you my friend!

1 Like