class Listener { public: Listener() { m_rosNode = rclcpp::Node::make_shared("Listener"); sub_ = m_rosNode->create_subscription("chatter", &Listener::callback); rclcpp::spin(m_rosNode); } void callback(const std_msgs::msg::String::SharedPtr msg) { RCLCPP_INFO(m_rosNode->get_logger(), "I heard: [%s]", msg->data.c_str()); } private: rclcpp::Subscription::SharedPtr sub_; std::shared_ptr\ m_rosNode; }; int main(int argc, char * argv[]) { rclcpp::init(argc, argv); Listener lister; rclcpp::shutdown(); return 0; } Hi I am a beginner, I wrote some codes described above. However, after ament build, it comes out an error: 5>C:\dev\ros2_2018_03_27_fastrtps\ros2-windows\include\rclcpp/function_traits.hpp(52): error C2825: 'FunctionT': must be a class or namespace when followed by '::' [D:\Repo\pj-dc_int\dc_fw\sr c\ros2_pub_sub_test\build\ros2_pub_sub_test\listener_1.vcxproj] can anyone help me! Thanks in advance. --- [Visit Topic](https://discourse.ros.org/t/ros2-node-definition-in-class/4826/1) or reply to this email to respond. If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates. ______________________________________________________________________________ ros-users mailing list ros-users@lists.ros.org http://lists.ros.org/mailman/listinfo/ros-users Unsubscribe: