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

Revision history [back]

click to hide/show revision 1
initial version

Be sure you've installed the ros extension for one. Aside from this, if you open the ros_ws folder (i.e. the one which holds the install, build, and src folders) then it should configure itself automatically.

If it doesn't open the .vscode/c_cpp_properties.json file and check that it contains the correct includePath. Mine for example:

{
  "configurations": [
    {
      "browse": {
        "databaseFilename": "",
        "limitSymbolsToIncludedHeaders": true
      },
      "includePath": [
        "${workspaceFolder}/**",
        "/opt/ros/foxy/include/**",
        "/usr/include/**"
      ],
      "name": "ROS"
    }
  ],
  "version": 4
}

I've inspired my setup a bit by https://www.allisonthackston.com/articles/vscode-docker-ros2.html, she provides a docker for a vscode setup. I've taken some inspiration here regarding figuring out some of the slightly more obscure settings.

Be sure you've installed the ros extension for one. Aside from this, if you open the ros_ws folder (i.e. the one which holds the install, build, and src folders) then it should configure itself automatically.

If it doesn't doesn't, open the .vscode/c_cpp_properties.json file and check that it contains the correct includePath. Mine for example:

{
  "configurations": [
    {
      "browse": {
        "databaseFilename": "",
        "limitSymbolsToIncludedHeaders": true
      },
      "includePath": [
        "${workspaceFolder}/**",
        "/opt/ros/foxy/include/**",
        "/usr/include/**"
      ],
      "name": "ROS"
    }
  ],
  "version": 4
}

I've inspired my setup a bit by https://www.allisonthackston.com/articles/vscode-docker-ros2.html, she provides a docker for a vscode setup. I've taken some inspiration here regarding figuring out some of the slightly more obscure settings.

Be sure you've installed the ros extension for one. Aside from this, if you open the ros_ws folder (i.e. the one which holds the install, build, and src folders) then it should configure itself automatically.

If it doesn't, open the .vscode/c_cpp_properties.json file and check that it contains the correct includePath. (the most important for this being ${workspaceFolder}/** and /opt/ros/foxy/include/**). Mine for example:

{
  "configurations": [
    {
      "browse": {
        "databaseFilename": "",
        "limitSymbolsToIncludedHeaders": true
      },
      "includePath": [
        "${workspaceFolder}/**",
        "/opt/ros/foxy/include/**",
        "/usr/include/**"
      ],
      "name": "ROS"
    }
  ],
  "version": 4
}

Again, for this to work vscode has to open in your ros_ws directory, such that it can walk through the install and src folders. Otherwise you can add them by manually backstepping in the include.

I've inspired my setup a bit by https://www.allisonthackston.com/articles/vscode-docker-ros2.html, she provides a docker for a vscode setup. I've taken some inspiration here regarding figuring out some of the slightly more obscure settings.