EEPROM compile errors when used in a library

Hello all!

I'm attempting to write a library that sits on top of EEPROM.h and I can't figure out the right way to do things.

The short version of the problem is that when I try to build my sketch I get a series of errors of the type:

EEPROM/EEPROM.h:38:5: error: expected specifier-qualifier-list before 'EERef'
     EERef( const int index )

If I just move all my code from my library to my actual sketch, it compiles fine, but I would very much like for this code to be reusable.

Any help here? Thanks.

I'm running into the same error trying syntastic to check my code.

Have you found a solution to this problem?

The short version of the problem is that when I try to build my sketch

You need to share the sketch and the library.

I'm running into the same error trying syntastic to check my code.

You need to share the sketch and the library.

There's nothing wrong with the sketch or the library, it runs fine on the arduino. (Even just the "#include <EEPROM.h>" statement on its own is enough to trigger the error.)

I was just hoping the OP had figured out the source of the problem.

The problem for me is with syntastic in any case, not arduino.

And meanwhile I think I know what the problem is: syntastic uses avr-gcc to check ino-files, whilst it should be using avr-g++

I don't immediately see a solution for the problem though, apart from changing the syntastic checker or adding a new one.

I was hoping I was simply missing some compile flag or library import, but it seems it's not that simple after all :slight_smile:

I was hoping I was simply missing some compile flag or library import, but it seems it's not that simple after all

Well thanks for sharing, even if it wasn't your code or your error messages. Good luck.

I got that error to go away when I renamed the .c file that imports the EEPROM to .cpp

1 Like