IDE 1.4.0 | CLI 2.11.2
This is related to but not exactly the same issue as described in “Nested Libraries” topic. I am building a set of library objects for a robot we want to deploy in our classroom. They worked well in the standard Arduino setup but we are experimenting with different IDEs and noticed some interesting behavior with Platformio.
All the test programs have been modified (minor changes) to work in the Platformio IDE but we have noticed some a behavior wrt how both our own and built-in libraries are imported. Eventually we will deploy the library on Git but are still in development so the custom libraries live in the lib folder of our test suite. (If it matters: most of the classroom machines are Ubuntu 16.04 but there are a few MacOSX machines as well)
One clear example: we have customized I2C classes that read from specific hardware where the source code depends on the Wire.h library. Including the Wire.h library in our source is not sufficient to allow the test module to compile unless we also #include it in the test module as well. to wit:
main.cpp:
// Main.cpp which would correspond to the .ino file
#include <Arduino.h>
#include <PhysBotEncoder.h>
...
void setup() { etc; }
void loop() { etc; }
PhysBotEncoder.cpp:
// PhysBotEncoder source file (the header doesn't
// need the Wire.h declarations
#include <Arduino.h>
#include <PhysBotEncoder.h>
#include <Wire.h>
...
stuff;
etc;
This arrangement will throw a message that Wire.h cannot be found. BUT if Wire.h is included in main.cpp then all is well. I have had similar issues with my own nested libraries which something described under the related post above but this is seems to happen with ‘built-in’ libraries as well.
I have tinkered with the ‘lib_ldf_mode’ setting and it doesn’t seem to change anything although I don’t think this works with the version I am playing with.
Is this expected behavior? Right now all our ‘custom libraries’ live in the lib folder of the main project. Each class declaration and source lives in its own folder. Can these be combined into one folder? I am just not clear on either the convention and the requirements on how to organize a complex project like this. I apologize if I missed something in the documentation. Thanks in advance for any assistance.