Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By Stevenelson
#18550 I'm making my first arduino library and I'm a little stumped maybe one of you could kindly point me in the right direction.

So I've made a series of functions that make using EEProm MUCH easier. The functions work fine in a regular arduino sketch, but once I move them into .h and .cpp files it doesn't want to include the eeprom.h base library.

Here's my eePromString.h file:

Code: Select all#ifndef EEPROMSTRING_H
#define EEPROMSTRING_H

#include "Arduino.h"
#include <EEPROM.h>

class eePromString
{
   public:
      eePromString(int length);
      void set(String name, String newvalue);
      void clear();
      String get(String name);
      String list();
      String Delete(String name);
   private:
      
};

#endif

But, I'm getting this error:

No such file or directory #include <EEPROM.h>

I have also tried including it in the .cpp file, I get the same error. It seems like it's looking for the file in the relative folder and not finding it. Do i have to include it with an absolute path or something?

Any suggestions would be very helpful!
User avatar
By burkmurray
#18696 Check your folder structure and case - the IDE is aggravatingly picky about where it expects to find files.

Your .h file needs to be in a folder/dir in your libraries directory, like this:

Libraries\EEPROM\EEPROM.h

And your #include is case sensitive: "#include EEPROM.h" will fail (with the error you quoted) if your file is named "eeProm.h".

Don't forget that the IDE won't recognize your library until you quit and restart.

Good luck, and congrats on your first library!