MenuBackend - error

Hi everyone.

I'm trying MenuBackend library and i don't know why have this error when i upload it to my arduino
I've use version :
http://www.arduino.cc/playground/uploads/Profiles/MenuBackend_1-4.zip

  • I checking MenuBackend it's have in the Arduino library folder.
  • In the sketch, I writing already:

#include <MenuBackend.h>

MenuBackend menu = MenuBackend(menuUseEvent,menuChangeEvent);
MenuItem menu1Item1 = MenuItem("Item1");
MenuItem menuItem1SubItem1 = MenuItem("Item1SubItem1");
MenuItem menuItem1SubItem2 = MenuItem("Item1SubItem2");
MenuItem menu1Item2 = MenuItem("Item2");
MenuItem menuItem2SubItem1 = MenuItem("Item2SubItem1");
MenuItem menuItem2SubItem2 = MenuItem("Item2SubItem2");
MenuItem menuItem3SubItem3 = MenuItem("Item2SubItem3");
MenuItem menu1Item3 = MenuItem("Item3");

void setup()
{
}

void loop()
{
}

void menuUseEvent(MenuUseEvent used)
{
}

void menuChangeEvent(MenuChangeEvent changed)
{
}

But still can't working and have an error status:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
exit status 1
'menuUseEvent' was not declared in this scope
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

You can try to move your event handlers to before you declare/define the menu.

No experience with the specific library.

The IDE creates function prototypes for you, for functions that take arguments of the type that the IDE understands. MenuUseEvent does not appear to be one that it understands.

So, be a real programmer, and define your own function prototypes.

Or, be a lazy programmer, and move all the functions before where they are referenced.

PaulS:
The IDE creates function prototypes for you, for functions that take arguments of the type that the IDE understands. MenuUseEvent does not appear to be one that it understands.

Ah, so that is why it sometimes works.

sterretje:
Ah, so that is why it sometimes works.

Yes. Things like reference arguments can confuse it, along with structs.

Figured out the problem:

Add the following before MenuBackend(menuUseEvent,menuChangeEvent);

static void menuChangeEvent(MenuChangeEvent changed);
static void menuUseEvent(MenuUseEvent used);