Create ros function package
Use the command catkin_create_pkg
Command format catkin_create_pkg [package_name] [depend1] [depend2] [depend3] ...
catkin_create_pkg chapter2_tutorials std_msgs roscpp
Among the dependencies:
std_msgs
Contains commonly used message types, representing basic data types and other basic message constructs, such as multidimensional array
roscpp
Use C++ to implement various functions of ROS, it provides a client library, so that C++ programmers can call these interfaces to quickly complete the development work related to ROS topics, services and related
Compile ROS function package
Use catkin_make command
Note that the command is run in the workspace folder, otherwise an error will be reported.
As shown in the figure above, the compilation is successful.