As far as I know, a circular dependency occurs when two include files (.h), include each other.
However I noticed that the LDF also detects circular dependencies when scanning .cpp files.
This leads to problems, mostly some include files not being found and so the build fails.
I tried to reproduce the problem with a minimalistic project : Strooom/demo_cr (github.com)
It has 2 lib folders ‘maincontrol’ and ‘network’, each containing a simple class with corresponding name, consisting of a .h file and a .cpp file:
lib
/maincontrol
maincontrol.h
maincontrol.cpp
/network
network.h
network.cpp
now maincontrol.cpp and network.cpp both include maincontrol.h and network.h
#include "maincontrol.h"
#include "network.h"
I think to c++ standards, this should be perfectly ok, but still when I build this in PIO, I get the warning
Scanning dependencies...
Warning! Circular dependencies detected between `C:\Users\pasca\Documents\Projects\Software\demo_cr\lib\network` and `C:\Users\pasca\Documents\Projects\Software\demo_cr\lib\maincontrol`
Dependency Graph
|-- maincontrol (License: Unknown, Path: C:\Users\pasca\Documents\Projects\Software\demo_cr\lib\maincontrol)
| |-- network (License: Unknown, Path: C:\Users\pasca\Documents\Projects\Software\demo_cr\lib\network)
|-- network (License: Unknown, Path: C:\Users\pasca\Documents\Projects\Software\demo_cr\lib\network)
Is there any solution to this ? The warning could be ignored, but I know from experience that in more complex project, eventually the LDF stops including files and as a result the build will fail…