Skip to content

Using class member functions as command callback #2

@eg321

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.

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