undefined symbol when loading custom rviz panel
Hello everyone,
I have some question when i write a panel for Rviz, when i add a extra .h file for my project. After CATKIN_MAKE with no Error, when i add it in Rviz, it show me this :
PluginlibFactory: The plugin for class 'Tiffer' failed to load. Error: Failed to load library /home/tiffer/tiffer-catkin/devel/lib/libtiffer_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/tiffer/tiffer-catkin/devel/lib/libtiffer_panel.so: undefined symbol: _ZN12tiffer_panel18CruiseLocationTool12onInitializeEv)
But I had add it in cpp, I use Kinetic under Ubuntu 16.04.
When I remove this .h file from my project, my panel works well again. Can someone tell my what's wrong with it?
Here is my .h file:
#ifndef TIFFER_CRUISELOCATION_H
#define TIFFER_CRUISELOCATION_H
#ifndef Q_MOC_RUN
#include <ros/ros.h>
#include "rviz/default_plugin/tools/pose_tool.h"
#endif
#include <QObject>
#include <QInputDialog>
using namespace rviz;
namespace tiffer_panel
{
class Arrow;
class DisplayContext;
class StringProperty;
class CruiseLocationTool : public PoseTool
{
Q_OBJECT
public:
CruiseLocationTool();
virtual void onInitialize();
protected:
virtual void onPoseSet(double x, double y, double theta);
private Q_SLOTS:
void updateTopic();
private:
ros::NodeHandle nh_;
ros::Publisher pub_;
};
}
#endif