You're reading the documentation for an older, but still supported, version of ROS 2. For information on the latest version, please have a look at Jazzy.
Building a package with Eclipse 2021-06
You cannot create a ROS 2 package with eclipse, you need to create it with commandline tools. Follow the Create a package tutorial.
After you created your project, you can edit the source code and build it with eclipse.
We start eclipse and select a eclipse-workspace.

We create a C++ project


We see that we got C++ includes.

We now import our ROS 2 project. The code is still in the old place.


Click the Advanced in the Options and check the Create links in worksapce.

We see in the source code that the C++ includes got resolved but not the ROS 2 ones.


Add include paths of needed packages. (e.g. /opt/ros/iron/include/rclcpp, /opt/ros/iron/include/std_msgs, etc.)

We now see that the ROS 2 includes got resolved too.

Adding Builder colcon, so that we can build with right-click on project and “Build project”.


With PYTHONPATH you can also build python projects.


Right-click on the project and select “Build Project”.
