title: Building error when declare tf2_ros::Buffer in class
body: <p>I am trying to use tf2_ros::Buffer in a simple code. When I put it in the main function, everything works fine. But when put in a class, building error occurs. The code is like this:</p>
  
  <pre><code>#include &lt;ros/ros.h&gt;
  #include &lt;tf2_ros/buffer.h&gt;
  #include &lt;tf2_ros/transform_listener.h&gt;
  #include &lt;geometry_msgs/TransformStamped.h&gt;
  #include &lt;geometry_msgs/Twist.h&gt;
  
  class test_class
  
  {
  private:
      double start;
      double duration;
      ros::Time start_time;
      ros::Time end_time;
      std::string robot_name;
  
      tf2_ros::Buffer tf_buffer; // problem line
      tf2_ros::TransformListener* tfListener;
      geometry_msgs::TransformStamped transformStamped;
  
  public:
      std::string space_name;
      std::string node_name;
  
      test_class()
      {
          space_name = ros::this_node::getNamespace();
          node_name = ros::this_node::getName();
      }
  
      ~test_class()
      {}
  
      bool initialize(const ros::NodeHandle&amp; n)
      {
          ROS_INFO("Class auto_mav_flight initialized done!");
          return true;
      }
      void timer_callback(const ros::TimerEvent&amp; event)
      {
          ROS_INFO("Timer Callback triggered.");
          return;
      }
  }; 
  
  int main(int argc, char** argv)
  {
      ros::init(argc, argv, "auto_mav_node");
      ros::NodeHandle node;
      ROS_WARN("The node is initilized and started.");
      test_class amf = test_class();
      amf.initialize(node);
      ros::Timer timer_1 = node.createTimer(ros::Duration(0.5), &amp;test_class::timer_callback, &amp;amf);
      ros::spin();
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>and the building error information is:</p>
  
  <pre><code>/home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp: In function ‘int main(int, char**)’:
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:73:44: error: no matching function for call to ‘test_class::test_class(test_class)’
    test_class amf = test_class();
                                              ^
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:73:44: note: candidates are:
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:26:2: note: test_class::test_class()
    test_class()
    ^
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:26:2: note:   candidate expects 0 arguments, 1 provided
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:9:7: note: test_class::test_class(test_class&amp;)
   class test_class
         ^
  /home/arkin/ros_code/sandbox/auto_mav_sandbox/src/auto_mav_flight/src/node_main.cpp:9:7: note:   no known conversion for argument 1 from ‘test_class’ to ‘test_class&amp;’
  make[2]: *** [auto_mav_flight/CMakeFiles/auto_mav_flight_node.dir/src/node_main.cpp.o] Error 1
  make[1]: *** [auto_mav_flight/CMakeFiles/auto_mav_flight_node.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>I found that if I comment the code line that declare the tf2_ros::buffer:</p>
  
  <pre><code> tf2_ros::Buffer tf_buffer;
  </code></pre>
  
  <p>the error disappear.</p>
  
  <p>Why the tf2_ros::Buffer can cause problem of class construction even I just declare it as a member of class?</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Thanks in advance.</p>