Skip to content

Commit 5a8da27

Browse files
per1234Curclamas
authored andcommitted
EEPROM library: Move #include of Arduino.h to header file (espressif#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);
1 parent dfef5bc commit 5a8da27

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

Diff for: libraries/EEPROM/EEPROM.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2525
*/
2626

27-
#include "Arduino.h"
2827
#include "EEPROM.h"
2928

3029
#include <esp_log.h>

Diff for: libraries/EEPROM/EEPROM.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#ifndef EEPROM_FLASH_PARTITION_NAME
3030
#define EEPROM_FLASH_PARTITION_NAME "eeprom"
3131
#endif
32+
#include <Arduino.h>
3233
extern "C" {
3334

3435
#include <stddef.h>

0 commit comments

Comments
 (0)