Closed twhiston closed 5 months ago
@drmpf Let me know if you want me to merge
With this change the SafeString_Tests->SafeStringPrint test sketch fails to compile on UNO and ESP32 (at least) under 1.8.19 Can you supply a #define that will restrict the change to Platform IO?
Thanks for testing this, I don't have either of those boards, unfortunately. I'm using an M0 Pro and this test compiles with that. Not sure if it's relevant but I did find that regardless of using the original code or with the prefixed arduino::
all tests after the first result in an error.
It doesn't seem like PlatformIO adds anything at all to the code which allows the preprocessor to tell if it's being used, which is slightly annoying. I'll see if I can get my hands on a board where it fails to compile to find a solution
@PowerBroker2 You can close this for now thanks (Can you drop me your email via forward.com.au at fcc ?)
Spoke too soon, I found a way to guard for this
Actually it is probably a board problem not a PlatformIO problem see the file SafeStringNameSpace.h and SafeStringNameSpaceStart.h These add the arduino name space for specific boards. Try adding a define test to those files for the board you are using
The m0 pro is defined as ARDUINO_SAMD_ZERO
, which means according to that file it's deliberately skipping using the namespace. I tried moving this to include the namespacing for this chipset and found that although it still seems to compile properly in the Arduino IDE I'm back to the initial problem with platformIO expected class-name before ',' token
so I think it might actually need a PlatformIO specific fix.
V4.1.27 of SafeString now has two PlatformIO version included. Read the readme in the PlatformIO sub-dir for the details of how to use them
Partial fix in V4.1.27
I found I couldn't build projects using this library with PlatformIO because you use Printable without prefixing the Arduino namespace to it. Simply adding this fixes it, and everything still builds successfully with the Arduino IDE.