Robotics StackExchange | Archived questions

Error with failing to load plugin because of undefined symbol

Here is our model_push.cpp file:

#include "model_push.h"
#include <ros/ros.h>
#include <ros/subscribe_options.h>
#include <sensor_msgs/JointState.h>
#include <math.h>
#include <ros/ros.h>
#include <ros/subscribe_options.h>
#include <boost/thread.hpp>
#include <boost/algorithm/string.hpp>
#include <sensor_msgs/JointState.h>

void ModelPush::addSubscribeForce()
{
    // ros::init("talker");

    ros::NodeHandle* rosnode = new ros::NodeHandle();
    ros::SubscribeOptions jointStatesSo = ros::SubscribeOptions::create<sensor_msgs::JointState>("/test", 1, SetJointStates,ros::VoidPtr(), rosnode->getCallbackQueue());
    ros::Subscriber subJointState = rosnode->subscribe(jointStatesSo);
    ros::spin();
}

Here is our model_push.h file:

#ifndef MODEL_PUSH_H
#define MODEL_PUSH_H

#include <string>

#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <gazebo/rendering/rendering.hh>
#include <ignition/math.hh>
#include <typeinfo>

#include <ros/ros.h>
#include <ros/callback_queue.h>
#include <ros/advertise_options.h>
#include <std_msgs/String.h>
#include <sensor_msgs/JointState.h>
#include <math.h>
#include <ros/ros.h>
#include <ros/subscribe_options.h>
#include <boost/thread.hpp>
#include <boost/algorithm/string.hpp>
#include <sensor_msgs/JointState.h>

using std::string;
using namespace gazebo;

/**
 * model_push abstraction class.
 */
class ModelPush
{
public:
    ModelPush(string name, physics::ModelPtr parent){
    ModelPush() {}
    ~ModelPush() {}

    void addSubscribeForce();
    static void SetJointStates(const sensor_msgs::JointState::ConstPtr);

When we run "make" for our workspace there is the error:

[Err] [Plugin.hh:178] Failed to load plugin libmodel_push.so: /Robosub_Simulation/devel/lib/libmodel_push.so: undefined symbol: _ZN9ModelPush14SetJointStatesERKN5boost10shared_ptrIKN11sensor_msgs11JointState_ISaIvEEEEE

Can you guys please assist us with how to solve this error?

Asked by ehiga on 2022-03-31 11:33:38 UTC

Comments

Answers