ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
[Posting incase anyone needs help]
All these answers are fine, but this is what worked for me, and it was very easy. It is similar to amer's answer.
When you open the file you are working on it will have the squiggles. If you have the C++ extension, when you hover your mouse over the headers you should be able to "Edit "includePath" Settings" via the "Quick Fix" button. There may also be a pop up on the bottom right of your screen from intellisense to configure the file.
When you click this it will create a "c_cpp_properties.json" file in a ".vscode" directory within the workspace you are working in. The file should look like this:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
All you need to do is add your distribution path to the "includePath" section. Your code should look something like this then.
...
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/kinetic/**"
],
...
Adding the " * " just indicates recursive search. For example, ${workspaceFolder}/* will search through all subdirectories while ${workspaceFolder} will not.
If your Service created .h files are also not showing up then it's probably because you aren't in the top level of your workspace, or your .h file is outside of your workspace. You can add their file path the same way as above. You can find these service .h files in the catkin_ws/devel/include/Service_Name directory of the workspace they were created in.