尝试将一个自定义的rviz插件编译时出现的错误。
PluginlibFactory: The plugin for class 'assistant_panel/Widget_interface' failed to load. Error: Failed to load library /home/xxx/ws/ws_linux/devel/lib/libassistant_panel.so. 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/xxx/ws/ws_linux/devel/lib/libassistant_panel.so: undefined symbol: _ZTVN15assistant_panel16Widget_interfaceE)
在cmakelist中,将add_library(${PROJECT_NAME} ${SRC_FILES})
改为 add_library(${PROJECT_NAME} ${SRC_FILES} ${HEADER_FILES})
。
这个问题主要存在于插件的cpp和.h文件不在同一目录下的情况。ROSANSWER中也有解答https://answers.ros.org/question/215487/could-not-load-panel-in-rviz-pluginlibfactory-the-plugin-for-class/
。