EEPROMWriteAnything issues

I am trying to use the EEPROM write anything code that allows any data type to be written to EEPROM but I am having some issues.
http://www.arduino.cc/playground/Code/EEPROMWriteAnything

My test code is this:

#include <EEPROM.h>

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

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

float val

void setup()
{
  Serial.begin(9600);
  EEPROM_readAnything(0, val);
  Serial.println(val);
}
void loop()
{
  //some random code here
  val = 10.60;
        EEPROM_writeAnything(0, val);
        Serial.println(val);
  //more random code
}

and it won’t compile, this is new to me so does anyone know why?

I get the error:

error: expected initializer before ‘void’ In function ‘void loop()’:

[smiley=dankk2.gif]

Mowcius

float val

Without looking through all, I see a missing ";" And it compiles, if you add it :)

arghhhhhhhhhhhhhhhh >:(

thanks!

I am such an idiot at the moment :smiley:

Mowcius