diff --git a/user/inc/Arduino.h b/user/inc/Arduino.h index 408650b7df..a4bbecbdb5 100644 --- a/user/inc/Arduino.h +++ b/user/inc/Arduino.h @@ -18,6 +18,15 @@ #include +#ifdef __cplusplus +// In order to support compiling with Clang, explicitly include cmath here since the Clang version +// of the math.h header included above does not include cmath. This is a no-op compiling with GCC +// since the GCC version of math.h includes cmath. We still include math.h under C++ for backwards +// compatibility with user code that might assume certain math functions in the global namespace from +// math.h. +#include +#endif + // #ifndef isnan // #error isnan is not defined please ensure this header is included before any STL headers // #endif @@ -303,4 +312,3 @@ typedef USARTSerial HardwareSerial; #endif /* ARDUINO_H */ - diff --git a/wiring/src/spark_wiring_usbserial.cpp b/wiring/src/spark_wiring_usbserial.cpp index 012f3c2236..b2ad8fc28d 100644 --- a/wiring/src/spark_wiring_usbserial.cpp +++ b/wiring/src/spark_wiring_usbserial.cpp @@ -24,6 +24,8 @@ ****************************************************************************** */ +#include + #include "spark_wiring_usbserial.h" #include "platform_headers.h"