library conflict: SparkFun_Si7021_Breakout_Library.h and OSCBundle.h

On a Teensy LC in Arduino IDE i’m getting compiler errors when using both libraries. Disabling either will allow my sketch to compile. The first 2 errors are these:

libraries/SparkFun_Si7021_Humidity_and_Temperature_Sensor/src/SparkFun_Si7021_Breakout_Library.h:40:22: error: expected identifier before numeric constant
#define ADDRESS 0x40

and

libraries/OSC/OSCMessage.h:65:9: note: in expansion of macro ‘ADDRESS’
ADDRESS,

any ideas whats going on? thanks.

hmm… I wanted to post a failing sketch here and started to copy/paste parts of my sketch into a new one and now it’s(the new sketch) working.

It appears to be the order of declaration

#include "SparkFun_Si7021_Breakout_Library.h"
#include <OSCBundle.h>

void setup() {}
void loop() {}

will give errors.

#include <OSCBundle.h>
#include "SparkFun_Si7021_Breakout_Library.h"

void setup() {}
void loop() {}

will not.

SparkFun_Si7021_Breakout_Library.h is defining ADDRESS to be 0x40. OSCMessage.h (included from OSCBundle.h) is trying to define an enum named ADDRESS, and if SparkFun_Si7021_Breakout_Library.h is included first, it tries to declare an enum called 0x40, which obviously won’t work.

Since the enum is a private enum only within the OSCBundle code, including OSCBundle.h first should be OK.

Sparkfun should change the #define (and ideally all macros/defines/public variables within SparkFun_Si7021_Breakout_Library.h) to have a unique prefix (ie. #define SI7012_ADDRESS 0x40) to avoid such conflicts.

/mike