StandardCplusplus
StandardCplusplus copied to clipboard
Added an important instruction to README.md.
Namely, that you need to #include <StandardCplusplus.h> . For searchability, I mention the error message that will appear if you fail to do this.
New instruction(s) are in a new section named "How do I use it?"
I'm assuming that the #include needs to be in every file that has STL #incldues...
Nope, it just needs to be in a single .ino file (or .c/.cpp file in a library that uses it). Doing so causes it to be put in the include path for all compilation runs.
I've added elaboration to my change.
I've done a bunch of experiments, and as best as I can tell, the rule is "you need (at least) one #include <StandardCplusplus.h>, and it has to appear before all your C++ standard library includes". But not #include'ing it yourself directly (when you use C++ std lib yourself) seems fragile. E.g. this does not build, but it does if you swap the two #include "a.h" vs. #include "b.h" lines in includez.ino
Ideally, you wouldn't need to #include <StandardCplusplus.h> at all, but I assume there is some technical limitation which prevents getting rid of this requirement?
Ideally, you wouldn't need to #include <StandardCplusplus.h> at all, but I assume there is some technical limitation which prevents getting rid of this requirement?
To decide what libraries a sketch needs, it builds a list of .h files that each library has. Then it runs the preprocessor on the sketch, to find out what files it tries to include but are not available. Every missing include is then matched against that list, to select a library for each one.
The problem here is that this library uses include files without the .h extension, which will not show up in the list and thus not allow the Arduino IDE to mark this library as required.
Does that clarify things? :-)