Library interferes with preprocessor expressions

I’m experiencing an issue where, after I include the SPARKFUN_PHOTON_WEATHER_SHIELD_LIBRARY in my project, I can no longer define string macros (preprocessor constants). It’s definitely related to the inclusion of this library as the following code is valid prior to inclusion and invalid after inclusion, with the error: token ““ELECTRON”” is not valid in preprocessor expressions.


void setup() {

Particle.publish("Hello World");


void loop() {


Can anyone explain why this is happening and how to fix the error?

I’m pretty sure you still can define them, but I’m not convinced you can compare the macro with a string litteral via the equality operator (==).
e.g. see here

Did you know about the PLATFORM_ID macro that is defined for you by the build enviroment?

With that you’d write

  Particle.publish("Hello World");

Nope, it’s (unsurprisingly) not building for me even without the library.
Just try a fresh project with nothing but your own code and try building.

Thank you @ScruffR. Your solution cuts through the problem entirely.