Defines, namespaces and online ide

I’m trying to compile GoogleTest/GoogleMock in the online IDE. (I have these successfully compiled locally.)

It seems as if a lot of the spark #defines are causing issues with this since they replace commonly used symbols. In this case A1, A2, A3 etc and the macro F.

Having these spark pin numbers as #defines makes it difficult to regulate their scope - they should ideally be constants in a namespace so they can be better managed by the compiler, and would avoid conflicts like this.

You can still have them appear in the ide by default by having the preprocessor add a using ::spark::io by default. But libraries will also be able to override these symbols.

1 Like