Another library fails to compile… any ideas why?

Constantin

Well-known member
EEPROMEx is a really neat library, allowing the quick and easy writing of just about any type of variable or array to EEPROM.

Trouble is, it will compile just fine on an AVR but fails on the Teensy 3… error code follows:
Code:
In file included from EEPROMEx.ino:9:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:23:20: fatal error: EEPROM.h: No such file or directory
compilation terminated.

The weird thing is that EEPROM.h is present in my list of libraries (Teensy 1.17 + Arduino 1.05). Any idea what might be going on?
 
Try adding an explicit:

Code:
#include <EEPROM.h>

before the include of EEPROMEx.h. This sometimes helps when the IDE can't deduce it needs to include EEPROM.h on its own.
 
You are fantastic - thanks!

So, now the Example file included with the library no longer complains about the lack of EEPROM.h. However, it still fails to compile and unfortunately, this is way over my head. The most I got into CS was intro to program and data types was the next class. I presume the below makes a lot more sense to the likes of you, who will forget more about C in a given day than I'll ever know.

Code:
In file included from EEPROMEx.ino:9:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:51:26: warning: ISO C99 requires whitespace after the macro name [enabled by default]
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:51:0: warning: "EEPROMSizeTeensy1" redefined [enabled by default]
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:50:0: note: this is the location of the previous definition
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:53:26: warning: ISO C99 requires whitespace after the macro name [enabled by default]
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:53:0: warning: "EEPROMSizeTeensy2" redefined [enabled by default]
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:52:0: note: this is the location of the previous definition
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:54:0: warning: "EEPROMSizeTeensy3" redefined [enabled by default]
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:39:0: note: this is the location of the previous definition
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMEx.h:166:22: error: conflicting declaration 'EEPROMClassEx EEPROM'
In file included from EEPROMEx.ino:8:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROM/EEPROM.h:39:20: error: 'EEPROM' has a previous declaration as 'EEPROMClass EEPROM'
EEPROMEx.ino: In function 'void readAndWriteInt()':
EEPROMEx:80: error: 'class EEPROMClass' has no member named 'writeInt'
EEPROMEx:81: error: 'class EEPROMClass' has no member named 'readInt'
EEPROMEx.ino: In function 'void readAndWriteLong()':
EEPROMEx:100: error: 'class EEPROMClass' has no member named 'writeLong'
EEPROMEx:101: error: 'class EEPROMClass' has no member named 'readLong'
EEPROMEx.ino: In function 'void readAndWriteFloat()':
EEPROMEx:120: error: 'class EEPROMClass' has no member named 'writeFloat'
EEPROMEx:121: error: 'class EEPROMClass' has no member named 'readFloat'
EEPROMEx.ino: In function 'void updateAndReadDouble()':
EEPROMEx:140: error: 'class EEPROMClass' has no member named 'updateDouble'
EEPROMEx:141: error: 'class EEPROMClass' has no member named 'readDouble'
EEPROMEx.ino: In function 'void writeAndReadCharArray()':
EEPROMEx:161: error: 'class EEPROMClass' has no member named 'writeBlock'
EEPROMEx:161: error: expected primary-expression before 'char'
EEPROMEx:161: error: expected ';' before 'char'
EEPROMEx:162: error: 'class EEPROMClass' has no member named 'readBlock'
EEPROMEx:162: error: expected primary-expression before 'char'
EEPROMEx:162: error: expected ';' before 'char'
EEPROMEx.ino: In function 'void writeAndReadByteArray()':
EEPROMEx:184: error: 'class EEPROMClass' has no member named 'writeBlock'
EEPROMEx:184: error: expected primary-expression before '>' token
EEPROMEx.ino:184:47: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:184:56: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx:185: error: 'class EEPROMClass' has no member named 'updateBlock'
EEPROMEx:185: error: expected primary-expression before '>' token
EEPROMEx.ino:185:67: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:185:74: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx:186: error: 'class EEPROMClass' has no member named 'readBlock'
EEPROMEx:186: error: expected primary-expression before '>' token
EEPROMEx.ino:186:46: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:186:54: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino: In function 'void waitUntilReady()':
EEPROMEx:212: error: 'class EEPROMClass' has no member named 'writeByte'
EEPROMEx:216: error: 'class EEPROMClass' has no member named 'isReady'
EEPROMEx:225: error: 'class EEPROMClass' has no member named 'writeLong'
EEPROMEx:229: error: 'class EEPROMClass' has no member named 'isReady'
EEPROMEx:237: error: 'class EEPROMClass' has no member named 'readLong'
EEPROMEx:241: error: 'class EEPROMClass' has no member named 'isReady'
EEPROMEx:256: error: 'class EEPROMClass' has no member named 'writeBlock'
EEPROMEx:256: error: expected primary-expression before '>' token
EEPROMEx.ino:256:47: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:256:55: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx:263: error: 'class EEPROMClass' has no member named 'updateBlock'
EEPROMEx:263: error: expected primary-expression before '>' token
EEPROMEx.ino:263:48: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:263:59: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx:270: error: 'class EEPROMClass' has no member named 'updateBlock'
EEPROMEx:270: error: expected primary-expression before '>' token
EEPROMEx.ino:270:48: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:270:59: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx:277: error: 'class EEPROMClass' has no member named 'readBlock'
EEPROMEx:277: error: expected primary-expression before '>' token
EEPROMEx.ino:277:46: warning: left operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino:277:54: warning: right operand of comma operator has no effect [-Wunused-value]
EEPROMEx.ino: In function 'void errorChecking(int)':
EEPROMEx:291: error: 'class EEPROMClass' has no member named 'writeLong'
EEPROMEx:297: error: 'class EEPROMClass' has no member named 'writeLong'
EEPROMEx.ino: In function 'void setup()':
EEPROMEx:309: error: 'class EEPROMClass' has no member named 'setMemPool'
EEPROMEx:313: error: 'class EEPROMClass' has no member named 'setMaxAllowedWrites'
EEPROMEx:318: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:319: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:320: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:321: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:322: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:323: error: 'class EEPROMClass' has no member named 'getAddress'
EEPROMEx:324: error: 'class EEPROMClass' has no member named 'getAddress'
 
Turns out there's a github repository for this library. I committed fixes here:

https://github.com/PaulStoffregen/Arduino-Libraries/tree/master/EEPROMEx

I'll also attach my patched copy to this message.

Teensy3 was missing one of the seldom-used AVR libc EEPROM library functions. I've added it. You'll need these 2 files, which go into hardware/teensy/cores/teensy3.

https://github.com/PaulStoffregen/cores/blob/master/teensy3/avr_functions.h
https://github.com/PaulStoffregen/cores/blob/master/teensy3/eeprom.c

With these 2 files (which I'll put in all future Teensyduino installers) and the patched library, it should compile and (hopefully) work correctly.

Please let me know how this works for you?
 

Attachments

  • EEPROMEx_patched.zip
    19 KB · Views: 483
Please let me know how this works for you?

I tried to compile the library you posted and it still gives error with the example programs under teensduino-1.17rc2 and arduino1.0.5. I made no changes to anything, just installed the library.
Here are the error's:

EEPROMEx.pde
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMex.cpp: In member function 'bool EEPROMClassEx::isReady()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMex.cpp:91:25: error: 'eeprom_is_ready' was not declared in this scope

EEPROMBackup.pde
In file included from EEPROMBackup.pde:18:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h: In constructor 'EEPROMBackupVar<T>::EEPROMBackupVar(T, int, compareFunction, long unsigned int)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h:41:24: error: 'class EEPROMClassEx' has no member named 'getAdress'
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h: In member function 'void EEPROMBackupVar<T>::initialize(T)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h:48:24: error: 'class EEPROMClassEx' has no member named 'getAdress'

EEPROMVar.pde
In file included from EEPROMVar.pde:10:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMvar.h: In constructor 'EEPROMVar<T>::EEPROMVar(T)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMvar.h:29:20: error: 'class EEPROMClassEx' has no member named 'getAdress'
 
nevermind I didn't install the updated core files that you clearly stated needed to be installed, too much turkey!
 
nevermind I didn't install the updated core files that you clearly stated needed to be installed, too much turkey!

ok i spoke too soon, EEPROMEx.pde compiles fine but the other two examples do not. I updated the eeprom.c and avr_functions.h core files.

EEPROMBackup.pde errors
In file included from EEPROMBackup.pde:18:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h: In constructor 'EEPROMBackupVar<T>::EEPROMBackupVar(T, int, compareFunction, long unsigned int)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h:41:24: error: 'class EEPROMClassEx' has no member named 'getAdress'
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h: In member function 'void EEPROMBackupVar<T>::initialize(T)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMBackupVar.h:48:24: error: 'class EEPROMClassEx' has no member named 'getAdress'

EEPROMVar.pde errors
In file included from EEPROMVar.pde:10:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMvar.h: In constructor 'EEPROMVar<T>::EEPROMVar(T)':
/Applications/Arduino.app/Contents/Resources/Java/libraries/EEPROMEx/EEPROMvar.h:29:20: error: 'class EEPROMClassEx' has no member named 'getAdress'

haven't really looked into these errors yet.
 
So I got EEPROMBackup to compile. There was a spelling error in EEPROMBackupVar.h line 41 & 48:
Code:
41: baseAddress = EEPROM.[COLOR=#FF0000]getAdress[/COLOR](sizeof(T)*adressRange);
48: baseAddress = EEPROM.[COLOR=#FF0000]getAdress[/COLOR](sizeof(T)*adressRange);
Adress should be Address!

That being said I'm still getting a error with EEPROMVar.pde:
EEPROMVar.pde: In function 'void readAndWriteVar(EEPROMVar<float>&)':
EEPROMVar:34: error: 'class EEPROMVar<float>' has no member named 'getAddress'

So the float class does not support getAddress i guess, have to look into this also.

haha, my dog was chewing my shoes when u replied.
 
Hi, Great to hear the library is being used! Paul submitted a bunch of fixes, so now the version on Github should not give any issues anymore. I will try to update the zip file later in the day.

I would be very interested to hear what people use the library for. If you want please post a reaction on my blog.

A side-note: I have removed the EEPROMBackupvar class for now. It is meant as a naive wear leveling mechanism, but this version only works in a limited set of cases. I'll change it into a more general version and re-add it when I have some time.

Thijs
 
Back
Top