error: expected primary-expression before ‘const’

  c++, ros

This is the code snippet that’s giving this error. The line has been marked in the code snippet.

Code

class ignition::gazebo::systems::amclPrivate
{
    public: Model model{kNullEntity};

    public: bool updateAmclPose(const EntityComponentManager &_ecm);

    public: std::string fixed_frame_;

    public: std::string robot_frame_;

    public: double rate_;

    
};

void amcl::Configure(const Entity &_entity,
    const std::shared_ptr<const sdf::Element> &_sdf,
    EntityComponentManager &_ecm,
    EventManager &_eventMgr)
amcl_nh_.setCallbackQueue(& amcl_queue_);
    amcl_pub_ = amcl_nh_.advertise<geometry_msgs::PoseWithCovarianceStamped>("amcl",1,true);

    thread_ptr_ = std::make_shared<std::thread>();
            {
                // Set process rate
                ros::Rate r(this->rate_);
                while (this->amcl_nh_.ok())
                {
        this->updateAmclPose(const EntityComponentManager &_ecm); ---This line gives error

                    this->amcl_pub_.publish(this->msg_);

                    this->amcl_queue_.callAvailable(ros::WallDuration(0.0));

                    r.sleep();
                }
            }

Error

error: expected primary-expression before ‘const’
this->updateAmclPose(const EntityComponentManager &_ecm);

Error(updated after changing the line)

error: no matching function for call to
‘ignition::gazebo::v3::systems::amcl::updateAmclPose(const
ignition::gazebo::v3::EntityComponentManager&)’
this->updateAmclPose((const EntityComponentManager &)_ecm);

PS: The code snippet given above is a minimal example. Full implementation can be found here

PS: To avoid confusion, I haven’t pasted full code. Can anybody suggest a solution?

Thanks

Source: Windows Questions C++

LEAVE A COMMENT