1

I am trying to use EEPROM library from Arduino framework for my ESP8266 project (NodeMCU). I am using Atom with Platformio.

Initialization of EEPROM is attempted at void setup() in main.cpp:

EEPROM.begin(80);

The compiler throws an error at this line with:

request for member 'begin' in '0', which is of non-class type 'int'

This is strange as I just follow a simple example from GitHub.

I include <EEPROM.h> just as <Arduino.h> and many others (<ESP8266WiFi.h>, <ESP8266WebServer.h>, <ESP8266mDNS.h>). Platformio has created .pio\build\nodemcuv2\lib32c\EEPROM directory with EEPROM.cpp.o inside but compilation fails.

How can I make it work and what else should I check to find the problem?

9
  • 1
    run the example code that is in the Arduino IDE Commented Aug 15, 2020 at 18:29
  • 1
    Instead of describing your code, show your code. Commented Aug 15, 2020 at 18:55
  • 1
    Then write some code that is only a few lines and demonstrates the problem. Commented Aug 15, 2020 at 19:08
  • 1
    Exactly what @Majenko said - if this is a problem then it should be easy to demonstrate in 10 lines of code. If you can't reproduce it in 10 lines of code then you have a very large clue as to what's going on. Commented Aug 15, 2020 at 20:10
  • 1
    Have you tried compiling one the examples supplied with the ESP8266 Arduino BSP (after adding #include <Arduino.h> to the top, of course) - maybe the eeprom_write one? If that works, you will be able to narrow it to something else in your code. Otherwise, you've probably got a corrupt install, or wrong platformio.ini configuration. You didn't add EEPROM to the lib_deps, did you? As you should be using the espressif8266 platform provided EEPROM library. Commented Aug 16, 2020 at 12:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.