I am getting the following error when attempting to compile my sketch:

In file included from sketch.ino:24:0: SerialRenderer.h:7: error: expected class-name before '{' token



#include <MenuSystem.h>

class SerialRenderer : public MenuComponentRenderer
    virtual ~SerialRenderer();

public: // methods from MenuComponentRenderer
    virtual void render(Menu const& menu) const;
    virtual void render_menu_item(MenuItem const& menu_item) const;
    virtual void render_back_menu_item(BackMenuItem const& menu_item) const;
    virtual void render_numeric_menu_item(NumericMenuItem const& menu_item) const;
    virtual void render_menu(Menu const& menu) const;


The contents of MenuSystem.h can be found at https://github.com/jonblack/arduino-menusystem/blob/master/MenuSystem.h.

It seems like the include of MenuSystem.h does not happen when SerialRenderer.h is included from my main sketch file. I get the same error if the include in SerialRenderer.h is removed.

Is there something simple I am missing for the compiler to be able to "see" MenuSystem.h?


Turns out I was looking at a newer version of the arduino-menusystem library than I had installed (version 2.1.1). That version did not have a class called MenuComponentRenderer.

I pulled the latest version from https://github.com/jonblack/arduino-menusystem/tree/master and it compiles fine.


It is most likely caused by the fact that a correct version of MenuSystem library is not properly installed. Check whether you can add the library to your sketch.

EDIT: added that also the version should be correct

  • I can include the library in my sketch via Sketch > Include Library. Also Library Manager shows that version 2.1.1 is installed. Jun 18 '16 at 15:19
  • Rembember to add the include to the sketch. The build will look at the sketch includes to add the necessary paths. Jun 18 '16 at 16:52
  • @MikaelPatel My main sketch is including both SerialRenderer.h and MenuSystem.h, but I get the same error whether or not MenuSystem.h is included. Jun 19 '16 at 13:07
  • Indeed the version is also important.
    – jantje
    Jun 19 '16 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.