ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Changing this

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in those two packages and anything else they depend on that also depend on rclcpp. ros2_ws sources for everything is easier and less error prone than that therefore https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/

Changing this

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in those two packages and anything else they depend on that also depend depends on rclcpp. ros2_ws sources for everything is easier and less error prone than that therefore https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.

Changing this

ament_target_dependencies(node_init
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in sources of those two packages and anything else they depend on that also depends on rclcpp. ros2_ws sources for everything is easier and less error prone than that therefore follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.

Changing this

ament_target_dependencies(node_init
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in sources of those two packages and anything else they depend on that also depends on rclcpp. rclcpp- but that is too much work to do manually so ros2_ws sources for everything is easier and less error prone than that therefore follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.

Changing this

ament_target_dependencies(node_init
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in sources of those two packages and anything else they depend on that also depends on rclcpp- but that is too much work to do manually so ros2_ws sources for everything is easier and less error prone therefore prone, follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.

These steps don't solve the problem, only avoid it:

Changing this

ament_target_dependencies(node_init
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in sources of those two packages and anything else they depend on that also depends on rclcpp- but that is too much work to do manually so ros2_ws sources for everything is easier and less error prone, follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.

These steps options don't solve the problem, only avoid it:they are just workarounds:

Changing this

ament_target_dependencies(node_init
  "ament_index_cpp"
  "class_loader"
  "rclcpp"
  "rcutils"
)

to

ament_target_dependencies(node_init
  "rclcpp"
  "ament_index_cpp"
  "class_loader"
  "rcutils"
)

avoids the problem- ament_index_cpp and/or class_loader are dependent on rclcpp so their includes come first. That doesn't seem like a good requirement to have so alternatively I would have to bring in sources of those two packages and anything else they depend on that also depends on rclcpp- but that is too much work to do manually so ros2_ws sources for everything is easier and less error prone, follow https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/ instead of any of this.