After trying out different things and getting help from Microsoft VSCode (and C/C++ extension) team on GitHub, it looks like the IntelliSense is not working probably because the extension is not able to find PCL headers.
In the case of Ubuntu, the PCL headers are generally stored at /usr/include/pcl-<version>
. In my Ubuntu 18.04, I have pcl-1.8
. So, ideally, adding "/usr/include/pcl-1.8/**"
under "includePath"
in c_cpp_properties.json
file should work. e.g.
{
"configurations": [
{
.
.
"includePath": [
"${workspaceFolder}/**",
"/usr/include/pcl-1.8/**"
],
.
.
.
}
],
"version": 4
}
In "/usr/include/pcl-1.8/**"
, **
is for recursive search under /usr/include/pcl-1.8/
directory. However, by the time when I had posted the question (and I think as of today as well), it doesn't work. It's not able to go through the subdirectories under pcl-<version>
directory. So, alternate solutions are below:
Solution 01: (Use this one if you want to apply changes only to the current project)
Open C/C++ Extension Configuration file: c_cpp_properties.json
(On Linux, press Ctrl + Shift + P and select C/C++: Edit Configurations (JSON)
)
Now, as the recursive search is not working, an alternate way is to specify all the subdirectories under includePath
:
{
"configurations": [
{
.
.
"includePath": [
"${workspaceFolder}/**",
"/usr/include/eigen3",
"/usr/include/pcl-1.8",
"/usr/include/pcl-1.8/pcl",
"/usr/include/pcl-1.8/pcl/2d",
"/usr/include/pcl-1.8/pcl/apps",
"/usr/include/pcl-1.8/pcl/common",
"/usr/include/pcl-1.8/pcl/compression",
"/usr/include/pcl-1.8/pcl/console",
"/usr/include/pcl-1.8/pcl/features",
"/usr/include/pcl-1.8/pcl/filters",
"/usr/include/pcl-1.8/pcl/geometry",
"/usr/include/pcl-1.8/pcl/impl",
"/usr/include/pcl-1.8/pcl/in_hand_scanner",
"/usr/include/pcl-1.8/pcl/io",
"/usr/include/pcl-1.8/pcl/kdtree",
"/usr/include/pcl-1.8/pcl/keypoints",
"/usr/include/pcl-1.8/pcl/ml",
"/usr/include/pcl-1.8/pcl/modeler",
"/usr/include/pcl-1.8/pcl/octree",
"/usr/include/pcl-1.8/pcl/outofcore",
"/usr/include/pcl-1.8/pcl/people",
"/usr/include/pcl-1.8/pcl/range_image",
"/usr/include/pcl-1.8/pcl/recognition",
"/usr/include/pcl-1.8/pcl/registration",
"/usr/include/pcl-1.8/pcl/ros",
"/usr/include/pcl-1.8/pcl/sample_consensus",
"/usr/include/pcl-1.8/pcl/search",
"/usr/include/pcl-1.8/pcl/segmentation",
"/usr/include/pcl-1.8/pcl/stereo",
"/usr/include/pcl-1.8/pcl/surface",
"/usr/include/pcl-1.8/pcl/tracking",
"/usr/include/pcl-1.8/pcl/visualization"
],
.
.
.
}
],
"version": 4
}
Solution 02: (Use this one if you want to apply changes globally -- across all the projects)
As C/C++ Configuration File: c_cpp_properties.json
is specific to each project, editing that will only apply changes to the current project. So, to apply changes across all the projects, one has to update settings.json
and then c_cpp_properies.json
.
Open settings.json
and add the following text:
"C_Cpp.default.includePath": [
"/usr/include/eigen3",
"/usr/include/pcl-1.8",
"/usr/include/pcl-1.8/pcl",
"/usr/include/pcl-1.8/pcl/2d",
"/usr/include/pcl-1.8/pcl/apps",
"/usr/include/pcl-1.8/pcl/common",
"/usr/include/pcl-1.8/pcl/compression",
"/usr/include/pcl-1.8/pcl/console",
"/usr/include/pcl-1.8/pcl/features",
"/usr/include/pcl-1.8/pcl/filters",
"/usr/include/pcl-1.8/pcl/geometry",
"/usr/include/pcl-1.8/pcl/impl",
"/usr/include/pcl-1.8/pcl/in_hand_scanner",
"/usr/include/pcl-1.8/pcl/io",
"/usr/include/pcl-1.8/pcl/kdtree",
"/usr/include/pcl-1.8/pcl/keypoints",
"/usr/include/pcl-1.8/pcl/ml",
"/usr/include/pcl-1.8/pcl/modeler",
"/usr/include/pcl-1.8/pcl/octree",
"/usr/include/pcl-1.8/pcl/outofcore",
"/usr/include/pcl-1.8/pcl/people",
"/usr/include/pcl-1.8/pcl/range_image",
"/usr/include/pcl-1.8/pcl/recognition",
"/usr/include/pcl-1.8/pcl/registration",
"/usr/include/pcl-1.8/pcl/ros",
"/usr/include/pcl-1.8/pcl/sample_consensus",
"/usr/include/pcl-1.8/pcl/search",
"/usr/include/pcl-1.8/pcl/segmentation",
"/usr/include/pcl-1.8/pcl/stereo",
"/usr/include/pcl-1.8/pcl/surface",
"/usr/include/pcl-1.8/pcl/tracking",
"/usr/include/pcl-1.8/pcl/visualization"
]
Open, c_cpp_properties.json
and update includePath
:
{
"configurations": [
{
.
.
"includePath": [
"${workspaceFolder}/**",
"${default}"
],
.
.
.
}
],
"version": 4
}
P.S. I had asked the same question on the official GitHub issues page of the C/C++ Extension by Microsoft and eventually, found the solution (but, not an ideal one) I mentioned above.
Here is the link for more info: https://github.com/microsoft/vscode-cpptools/issues/5843