Unable to include local C++ dependencies in VSCode

686 views Asked by At

I am having an issue with writing code for my Robotic Operating System (ROS) project, however it's more related to dependency inclusion. Here is as far as I got with the code:

// ROS
#include <ros/ros.h>

// MoveIt
#include "moveit/moveit_ros/planning_interface/planning_scene_interface/include/*"
#include "moveit/moveit_ros/planning_scene_interface/planning_scene_interface.h"
#include <moveit/move_group_interface/move_group_interface.h>

// TF2
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>

// The circle constant tau = 2*pi. One tau is one rotation in radians.
const double tau = 2 * M_PI;

int main(){
    
}

The issue is that dependency 2 through to 4 are not identified by VSCode. I attempted to include the necessary path within c_cpp_properties.json for dependency 2 as such:

"/home/george/ws_moveit/src/moveit/moveit_ros/planning_interface/planning_scene_interface/include/**"

The full c_cpp_properties.json looks as such:

{
    "configurations": [
        {
            "browse": {
                "databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db",
                "limitSymbolsToIncludedHeaders": false
            },
            "includePath": [
                "/home/george/ws_moveit/devel/include/**",
                "/opt/ros/noetic/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_planners/chomp/chomp_motion_planner/include/**",
                "/home/george/ws_moveit/src/geometric_shapes/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_planners/chomp/chomp_interface/include/**",
                "/home/george/ws_moveit/src/moveit_resources/prbt_ikfast_manipulator_plugin/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_ros/benchmarks/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_plugins/moveit_ros_control_interface/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_ros/move_group/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_ros/occupancy_map_monitor/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_ros/robot_interaction/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_ros/moveit_servo/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_setup_assistant/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_plugins/moveit_simple_controller_manager/include/**",
                "/home/george/ws_moveit/src/moveit_visual_tools/include/**",
                "/home/george/ws_moveit/src/pick_place/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_planners/pilz_industrial_motion_planner/include/**",
                "/home/george/ws_moveit/src/moveit/moveit_planners/pilz_industrial_motion_planner_testutils/include/**",
                "/home/george/ws_moveit/src/rviz_visual_tools/include/**",
                "/home/george/ws_moveit/src/srdfdom/include/**",
                "/usr/include/**",
                "/opt/ros/noetic/include",
                "/home/george/ws_moveit/src/moveit/moveit_ros/planning_interface/planning_scene_interface/include/**"
            ],
            "name": "ROS",
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "gnu11",
            "cppStandard": "c++14",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

This hasn't resolved my issue.

The way the packages are structured could be found here: https://github.com/ros-planning/moveit. It is essentially identical to the way I have them structured on my drive, with the the difference being the inclusion of the home/user directory.

The file in question should be located here: https://github.com/ros-planning/moveit/tree/master/moveit_ros/planning_interface/planning_scene_interface/include/moveit/planning_scene_interface

Am I missing some detail or made an error?

1

There are 1 answers

0
Alex On

#include "moveit/moveit_ros/planning_interface/planning_scene_interface/include/*"

Wildcards are not allowed in include statements, unless you have a very... weird preprocessor.

Reference the files you want to include directly, or use a master header file that directly contains all the files you want to include.