warning: 'EEPROM' defined but not used


I have this header file for an class to manipulate some data using eeprom.


#include <EEPROM.h>

#define _getLimit() EEPROM.get(0, _c)

class MyData{


In cpp file i use macros defined in header.
When i try to compile i got this error:

warning: 'EEPROM' defined but not used [-Wunused-variable]

I don’t know why because in macro definition i use static EEPROM method.
How can solve this?

Thanks in advance!

Remove the () in your define as you don't have any parameters and give it another go

What is _c ?

vlad2005: When i try to compile i got this error:

[u]warning[/u]: 'EEPROM' defined but not used [-Wunused-variable]

You have posted a warning message. In some case, such as your case, they can be ignored.

Fixed! After read more i found that this is an bad using of static class. Is like i'm cloning original class, witch is obviously bad, at least in this case. So I deleted macro definitions from header file and move include directive inside cpp file. Now warning is gone. Then in all methods i use static methods from EEPROM class.

@J-M-L Reading C docs, for function like macro, even if no parameter i see that () are used. I already modified source and donţt want to go back, but i don't think that will work

@Coding Badly Sorry, i typed wrong. Is an warning.