VS Code include error for custom message headers, but builds fine
Hello,
I tried a lot but cannot get rid of the include errors of my custom messages in vs code. Everything builds fine, but vs code does not seem to find the generated headers. I edited the "includePath" in ccppproperties.json to point to the location of non default headers and it worked for everything but not my custom messages.
Here is a screenshot to show it. https://imgur.com/corGr4R
My ccppproperties.json looks like this:
{
"configurations": [
{
"name": "ROS",
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/opt/ros/noetic/include",
"/usr/include/**",
"${workspaceFolder}/devel/include",
"${workspaceFolder}/**",
"/usr/local/include/opencv4", // OpenCV installed from source
"/home/julian/freenect2/include/**", // Freenect2
"/home/julian/installers/FRI-Client-SDK_Cpp" // SDK for FRI from KUKA
],
"intelliSenseMode": "gcc-x64",
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
I would appreciate any help that might solve this issue.
Thanks
Asked by JulianR on 2021-05-04 11:43:26 UTC
Answers
Came across the same problem:
Adding "${workspaceFolder}/../../devel/include"
to the include path in c_cpp_properties.json
solved the problem
Asked by JaFeKl on 2022-04-02 03:33:54 UTC
Comments
I think it will be different for each of us. and basically it should point to the /devel/include
but it depends where your .vscode/
is located. you give the relative path wrt that. in your case I suppose you have the file tree something like below
catkin_ws
|- build
|- devel
|- src
|- my_meta_pkg
|- my_pkg_1
|- .vscode/
|- src/
|- include/
|- CMakeLists.txt
|- package.xml
|- my_pkg_2
Asked by aarsh_t on 2022-04-02 05:47:52 UTC
Comments
instead of this
may be you can try to put whole path of package? something like
or
for me the last one is working.
Asked by aarsh_t on 2021-05-04 14:45:28 UTC
Thanks for the answer. I tried both but they don't work for me either. I tried to reinstall the C/C++ Extension but it also did not work. Weird thing is that I have the same problem on both of my pcs.
Asked by JulianR on 2021-05-04 16:19:54 UTC
One more thing came in my mind that,
${workspaceFolder}
might not be pointing to the ros workspace (I am not sure how your vscode workspace has been set-up) . can you try to put direct path to devel folder of your ros workspace?Asked by aarsh_t on 2021-05-04 17:17:40 UTC
Thanks, I tried it but it did not work for me either. I Also tried to reinstall vscode from apt or software center and deleted all config files before, but also no luck.
Asked by JulianR on 2021-05-05 03:14:31 UTC
Oh. No idea thn. sorry :(
Asked by aarsh_t on 2021-05-05 12:07:55 UTC