I very new to arduino and been work on code that is going to be use as a Traffic Counter. I got the first page error fix, but I can't get the 2nd page fix. Can someone look at and let me know what I'm doing wrong.
Thank You
David
Code:
#include <WProgram.h>
#include <EEPROM.h>
template 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 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;
}
2nd Code:
#include <Arduino.h>>
#include <EEPROM.h>
template 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 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;
}
Error Code:
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\traffic_counter_software_v5.ino:17:0:
sketch\EEPROMAnything.h:1:21: warning: extra tokens at end of #include directive
#include <Arduino.h>>
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\EEPPROMAnything.ino:23:0:
sketch\EEPROMAnything.h:1:21: warning: extra tokens at end of #include directive
#include <Arduino.h>>
^
EEPPROMAnything:4: error: redefinition of 'template int EEPROM_writeAnything(int, const T&)'
template int EEPROM_writeAnything(int ee, const T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\traffic_counter_software_v5.ino:17:0:
sketch\EEPROMAnything.h:4:24: note: 'template int EEPROM_writeAnything(int, const T&)' previously declared here
template int EEPROM_writeAnything(int ee, const T& value)
^
EEPPROMAnything:13: error: redefinition of 'template int EEPROM_readAnything(int, T&)'
template int EEPROM_readAnything(int ee, T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\traffic_counter_software_v5.ino:17:0:
sketch\EEPROMAnything.h:13:24: note: 'template int EEPROM_readAnything(int, T&)' previously declared here
template int EEPROM_readAnything(int ee, T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\EEPPROMAnything.ino:23:0:
EEPROMAnything.h:4: error: redefinition of 'template int EEPROM_writeAnything(int, const T&)'
template int EEPROM_writeAnything(int ee, const T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\traffic_counter_software_v5.ino:17:0:
sketch\EEPROMAnything.h:4:24: note: 'template int EEPROM_writeAnything(int, const T&)' previously declared here
template int EEPROM_writeAnything(int ee, const T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\EEPPROMAnything.ino:23:0:
EEPROMAnything.h:13: error: redefinition of 'template int EEPROM_readAnything(int, T&)'
template int EEPROM_readAnything(int ee, T& value)
^
In file included from C:\Users\David\Documents\Arduino\traffic_counter_software_v5\traffic_counter_software_v5.ino:17:0:
sketch\EEPROMAnything.h:13:24: note: 'template int EEPROM_readAnything(int, T&)' previously declared here
template int EEPROM_readAnything(int ee, T& value)
^
exit status 1
redefinition of 'template int EEPROM_writeAnything(int, const T&)'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.