PlatformIO Community

Undefined reference to library files in subdirectory of \libdeps

In my library (e.g BroRotaryEncoder), I have implemented State pattern, and all states were moved to separated folder “State”. When I register it in Library Manager and test, it didn’t compile
doesn't work
When I move the whole library files to “src” folder, it became compiled. Without State folder (and with fixed includes there) it compiles as well.

What do I do wrong?

work
Compiled version

To check if you lib code is compiled you can look into your .pio folder and you should find something like libState.a in one of the libXXX folder.
If you find it, your lib is compiled but the linker fail.

I have the same kind of issue when I compile on Ubuntu.
Are you on Ubuntu too?

Here is an example of my compilation failing : https://github.com/Luos-io/Examples/runs/710098619?check_suite_focus=true

no, I have windows 10

Can you find your libState.a file ?

nope, there is no such file.
I don’t understand why I should check my lib is compiled to see the file if I just can build it?=)

Indicates that files in the State folder are not compiled. Where is the library for reproduction?

you can install and load “BroRotaryEncoder” from Library Manager of PlatformIO in VS Code and try. It compiles with the same structure of files but in “src” folder. I have attached the image above.

Yes you are right, I will make a dedicated post to my problem which is different indeed.

Long story short, I restructured the project files (removed State folder) and it worked. But I still have no idea how to use folders in own libraries.