Skip to content

Build error in autotension.cpp #26

@MartijnZ

Description

@MartijnZ

kHi,

Today I compiled libbarrett and I ran into the following compile error:

libbarrett/programs/autotension.cpp:553:63: error: redeclaration of ‘bool AutoTension<DOF>::engage(int, double)’ may not have default arguments [-fpermissive]
 bool AutoTension<DOF>::engage(int motor, double timeout = 20.0) {

This error occurs because the default value for the argument timeout is in the function definition instead of the function declaration. From cppreference.com:

For member functions of class templates, all defaults must be provided in the initial declaration of the member function.

When changing the function declaration to (line 215)

    bool engage(int motor, double timeout=20.0);

And removing the default value from the function definition (line 553):

template<size_t DOF>
bool AutoTension<DOF>::engage(int motor, double timeout) {

The problem was resolved.

Note that I'm used GCC 5.4.0 to compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions