ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

RQT Custom Plugin: Could not load library: Undefined Symbol

asked 2018-07-22 20:53:11 -0500

squidonthebass gravatar image

updated 2018-07-22 22:03:01 -0500

jayess gravatar image

Hello all. I've been using ROS Indigo for about a year now on various projects and finally am starting to experiment with creating custom plugins for RQT. I spent a few days introducing myself to Qt and have now been trying to just get a very simple plugin adapted from Qt to RQT just to see how the process works, working off of the rqt_example_cpp class. When working, the Plugin should produce a QPushButton that, upon being pressed, displays a message to ROS_INFO and changes the text of the button (I was trying to keep this super simple just to understand the process of switching from Qt to RQT).

As far as I can tell I have everything laid out the same as the example, and my code compiles, but when I try to open my plugin (aptly called "test_button") in RQT I get the following error:

[ERROR] [1532309616.004701941]: Failed to load nodelet [rqt_testing/test_button_1] of type [rqt_testing/test_button]: Failed to load library /home/mike/catkin_ws/devel/lib// Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/mike/catkin_ws/devel/lib// undefined symbol: _ZTVN11rqt_testing11test_buttonE)

RosPluginlibPluginProvider::load_explicit_type(rqt_testing/test_button) failed creating instance
PluginManager._load_plugin() could not load plugin "rqt_testing/test_button": RosPluginlibPluginProvider.load() could not load plugin "rqt_testing/test_button"

When I comment out Q_OBJECT in my code the error goes away and the plugin loads, but then of course I can't utilize slots or signals as I'd like, so the plugin is ultimately useless.

I figure instead of linking the code from a bunch of different files that it would be easier to just post my repository, which I've done here. That being said, I've linked the source, header, and CMakeLists files below in case somebody catches an easy problem in one of those. I would really appreciate if somebody could help me out on this, as I've been smacking my head against a wall for a few days now trying to figure out this problem and have made about zero headway on it. Thanks!


#include "rqt_testing/test_button.h"

#include <pluginlib/class_list_macros.h>
#include <ros/master.h>
#include <QStringList>

namespace rqt_testing {

  : rqt_gui_cpp::Plugin()
  , widget_(0)

void test_button::initPlugin(qt_gui_cpp::PluginContext& context)
  QStringList argv = context.argv();

  widget_ = new QWidget();

  //adds number if more than 1 of this plugin?
  if (context.serialNumber() > 1)
    widget_->setWindowTitle(widget_->windowTitle() + " (" + QString::number(context.serialNumber()) + ")");


  connect(ui_.pushButton, SIGNAL(pressed()), this, SLOT(on_pushButton_clicked()));


bool test_button::eventFilter (QObject* watched, QEvent* event)
  return true;

void test_button::shutdownPlugin() 


void test_button::on_pushButton_clicked()
  ROS_INFO("Pressed the button");

} //namespace rqt_testing

PLUGINLIB_EXPORT_CLASS(rqt_testing::test_button, rqt_gui_cpp::Plugin)


#ifndef rqt_testing_test_button_H
#define rqt_testing_test_button_H

#include <rqt_gui_cpp/plugin.h>
#include <rqt_testing/ui_test_button.h>

#include <QWidget>
#include <QString>

namespace ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-06-07 12:08:50 -0500

AndyZe gravatar image

@William had a good answer here:

By default, the linker doesn't check that shared libraries are linked correctly, so it doesn't display much useful information upon failure. You can change that by setting the linker flag:

set(CMAKE_CXX_FLAGS "-Wl,--no-undefined")

Then you should get much more detailed error messages.

edit flag offensive delete link more

answered 2018-07-23 20:33:40 -0500

squidonthebass gravatar image

Did some more debugging after getting some rest. Turns out I had changed some names in my CMakeLists.txt that was causing the MOCS and UIS_H wrappers to not be made, notably the lines

if("${qt_gui_cpp_USE_QT_MAJOR_VERSION} " STREQUAL "5 ")
  qt5_wrap_cpp(rqt_testing_MOCS ${test_button_HDRS})
  qt5_wrap_ui(rqt_testing_UIS_H ${test_button_UIS})
  qt4_wrap_cpp(rqt_testing_MOCS ${test_button_HDRS})
  qt4_wrap_ui(rqt_testing_UIS_H ${test_button_UIS})

Changing instances of "test_button" to "rqt_testing" in these lines has allowed for my code to now be working correctly. Amazing what an (almost) full nights rest can do!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-07-22 20:53:11 -0500

Seen: 1,496 times

Last updated: Jun 07 '20