Skip to content

Commit 8478faa

Browse files
authored
Add some additional includes to the C++ pub/sub example. (ros2#583)
Signed-off-by: Chris Lalancette <[email protected]>
1 parent fbbcace commit 8478faa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ Open the file using your preferred text editor.
7474
.. code-block:: C++
7575

7676
#include <chrono>
77+
#include <functional>
7778
#include <memory>
79+
#include <string>
7880

7981
#include "rclcpp/rclcpp.hpp"
8082
#include "std_msgs/msg/string.hpp"
@@ -119,8 +121,8 @@ Open the file using your preferred text editor.
119121
2.1 Examine the code
120122
~~~~~~~~~~~~~~~~~~~~
121123

122-
The first line of code includes the ``<chrono>`` header so you can use ``chrono_literals``, or the ``500ms`` later on.
123-
Following the ``memory`` header is the ``rclcpp/rclcpp.hpp`` include which allows you to use the most common pieces of the ROS 2 system.
124+
The top of the code includes the standard C++ headers you will be using.
125+
After the standard C++ headers is the ``rclcpp/rclcpp.hpp`` include which allows you to use the most common pieces of the ROS 2 system.
124126
Last is ``std_msgs/msg/string.hpp``, which includes the built-in message type you will use to publish data.
125127

126128
These lines represent the node’s dependencies.
@@ -129,7 +131,9 @@ Recall that dependencies have to be added to ``package.xml`` and ``CMakeLists.tx
129131
.. code-block:: C++
130132

131133
#include <chrono>
134+
#include <functional>
132135
#include <memory>
136+
#include <string>
133137

134138
#include "rclcpp/rclcpp.hpp"
135139
#include "std_msgs/msg/string.hpp"

0 commit comments

Comments
 (0)