Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code IncludePath Issue with ROS headers

I'm getting squiggly lines under the statements of #include "rclcpp/rclcpp.hpp" from the ROS2 tutorial I'm going through and updating IncludePath in c_cpp_properties.json is not fixing the issue.

Here's what my c_cpp_properties file looks like:

{
    "configurations": [
        {
            "browse": {
                "databaseFilename": "",
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "/opt/ros/foxy/include/**",
                "/home/thomas/ws_ros2/src/cpp_pubsub/include/**",
                "/usr/include/**"
            ],
            "name": "ROS",
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++14",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

The ROS extension recognizes that I'm working with a ROS package so my settings.json looks like this:

{
    "python.autoComplete.extraPaths": [
        "/home/thomas/ws_ros2/install/warehouse_ros_mongo/lib/python3.8/site-packages",
        "/home/thomas/ws_ros2/install/moveit_msgs/lib/python3.8/site-packages",
        "/opt/ros/foxy/lib/python3.8/site-packages"
    ],
    "C_Cpp.errorSquiggles": "Enabled"
}

But no matter what I do I can't seem to get rid of these squiggles.

enter image description here

like image 894
optical_anathema Avatar asked Oct 17 '25 13:10

optical_anathema


2 Answers

  1. Update the "includePath": [] configuration in your .vscode/c_cpp_properties.json file with the following:
            "includePath": [
                "${workspaceFolder}/**",
                "/opt/ros/noetic/include/**",
                "/usr/include/eigen3"
            ],
  1. Open your ros workspace with VScode directly code my_ros_ws. both work for me
like image 167
Mubashir Avatar answered Oct 19 '25 09:10

Mubashir


Removing configurationProvider from c_cpp_properties.json did the trick and intellisense is working now. enter image description here

like image 41
optical_anathema Avatar answered Oct 19 '25 08:10

optical_anathema



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!