Skip to content

Using class member functions as command callback #2

Description

@eg321

Hi,

it looks like there is no easy way to "registerCommand" which should call member function of same class.

I've tried in this way:
commandParser.registerCommand("help", "", &cmd_displayHelp);

where "cmd_displayHelp" is member of same class.

It fails compilation with error: ISO C++ forbids taking the address of an unqualified or parenthesized non- static member function to form a pointer to member function. Say '&SerialController::cmd_displayHelp' [-fpermissive] commandParser.registerCommand("help", "", &cmd_displayHelp);

Had I forgot something or there is no way to do that with current syntax of "registerCommand"?

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions