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

For the code snippet in the task.json:

"args": [
             "-g",
             "${file}",
              "-o",
              "${fileDirname}/${fileBasenameNoExtension}"
          ],

g++ doesn't build your source file with -I option, which means the ROS header is not included.

You can create a new task with a new task

    {
        "type": "shell",
        "command": "catkin build",
        "problemMatcher": [],
        "label": "catkin build",
    },

This will save a lot of trouble with constructing g++ options and build directly from CMakeList.txt.

For the code snippet in the task.json:

"args": [
             "-g",
             "${file}",
              "-o",
              "${fileDirname}/${fileBasenameNoExtension}"
          ],

g++ doesn't build your source file with -I option, which means the ROS header is not included.

You can create a new task with a new taskwith

    {
        "type": "shell",
        "command": "catkin build",
        "problemMatcher": [],
        "label": "catkin build",
    },

This will save a lot of trouble with constructing g++ options and build directly from CMakeList.txt.