If I create a ROS package with multiple CMake targets (executables or libraries), each source file in the editor will be erroneously associated with all the targets instead of only the one that the source file is linked against. This can cause errors with code completion and semantic highlighting: if the default context for a ROS node .cpp file is from a non-ROS executable, all rclcpp usages will show errors in the editor even though the project will build successfully.
A workaround is to manually change the target in the dropdown menu to the top right of the editor to match the source file being edited.
If I create a ROS package with multiple CMake targets (executables or libraries), each source file in the editor will be erroneously associated with all the targets instead of only the one that the source file is linked against. This can cause errors with code completion and semantic highlighting: if the default context for a ROS node .cpp file is from a non-ROS executable, all rclcpp usages will show errors in the editor even though the project will build successfully.
A workaround is to manually change the target in the dropdown menu to the top right of the editor to match the source file being edited.