Template Class inside Class error

So I have a template Class in my sketch, in this case its to read from EEPROM, and this has been working fine for a long time.

template <class T> int EEPROM_readAnything(int ee, T& value)
{
  byte* p = (byte*)(void*)&value;
  unsigned int i;
  for (i = 0; i < sizeof(value); i++)
    *p++ = EEPROM.read(ee++);
  return i;
}

I started putting LCD code from a larger program into a library/class:

void SSD1963::font_16(int x, int y, byte fc, uint8_t ascii, byte back, int rota)  {  //  xposition, yposition, font colour , ascii code, background colour
  uint16_t a;
  int num_char;

  ascii -= 32; // removed un-used ascii slots to save memory, this compensates for missing slots that are not used
  for (int k = 0; k < 18; k++) // number of bytes (colons) in the letter(max)
  {
    num_char++;
    //    uint16_t a = font_16_E[ascii][k];  // read ascii from dynamic memory (only if loaded)
   EEPROM_readAnything(ascii * 38 + k * 2, a); // read from ascii table saved to EEPROM

Its give me this error: EEPROM_readAnything was not declared in this scope"

That error implies that it is looking for it in the header/cpp file and can’t find it. I’m assuming that I will have to duplicate the code inside my class and have tried but I don’t know the proper way to do that as it still gives the same error.

I’m assuming that I will have to duplicate the code inside my class

That would be the worst possible way to do it.

Put the EEPROM_readAnything and EEPROM_writeAnything functions in a header file, and include that file in the sketch and in the class source file.

Are the two functions in the same class?

I added it, and so far it seems to work.

I don't particularly like that I have to include EEPROM.h in my header to make it work but I suppose its next to impossible for modern installs to be missing it. :sweat_smile:

harddrive123:
I added it, and so far it seems to work.

I don't particularly like that I have to include EEPROM.h in my header to make it work but I suppose its next to impossible for modern installs to be missing it. :sweat_smile:

You have to include it because you're using the Arduino EEPROM functions.

Quite honestly, these functions of yours have been made redundant ever since the put and get functions were added to the EEPROM library. You might as well use those.