From c830511f012271d3738227cd70d6bc45172a54ab Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 16 Jul 2018 11:44:36 -0700 Subject: [PATCH] EEPROM library: Move #include of Arduino.h to header file (#1641) EEPROM.h uses data types which are declared through Arduino.h but that file does not contain an #include directive for Arduino.h. This does not cause any problems when the EEPROM library is #included from a .ino file because the Arduino IDE automatically adds an #include directive for Arduino.h but this is not the case for .cpp files. If a .cpp file has an #include directive for EEPROM.h that does not follow an #include directive for Arduino.h then compilation fails: E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:91:5: error: 'float_t' does not name a type float_t readFloat(int address); ^ E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:92:5: error: 'double_t' does not name a type double_t readDouble(int address); ^ E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:95:5: error: 'String' does not name a type String readString(int address); ^ E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:110:36: error: 'float_t' has not been declared size_t writeFloat(int address, float_t value); ^ E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:111:37: error: 'double_t' has not been declared size_t writeDouble(int address, double_t value); ^ E:\arduino\hardware\espressif\esp32\libraries\EEPROM/EEPROM.h:114:37: error: 'String' has not been declared size_t writeString(int address, String value); --- libraries/EEPROM/EEPROM.cpp | 1 - libraries/EEPROM/EEPROM.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/EEPROM/EEPROM.cpp b/libraries/EEPROM/EEPROM.cpp index 1138ecff..0e91f987 100644 --- a/libraries/EEPROM/EEPROM.cpp +++ b/libraries/EEPROM/EEPROM.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Arduino.h" #include "EEPROM.h" #include diff --git a/libraries/EEPROM/EEPROM.h b/libraries/EEPROM/EEPROM.h index 2e4383c9..3a9165e3 100644 --- a/libraries/EEPROM/EEPROM.h +++ b/libraries/EEPROM/EEPROM.h @@ -29,6 +29,7 @@ #ifndef EEPROM_FLASH_PARTITION_NAME #define EEPROM_FLASH_PARTITION_NAME "eeprom" #endif +#include extern "C" { #include