Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99131

Visual Studio Code "cannot open source file" error when including OpenCV

$
0
0

I'm using Visual Studio Code to develop a C++ project, and I have OpenCV installed in a custom location. However, it complains with the following error when I try to include header files from OpenCV:

#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit (/home/.../dev/communication-module/modules/.../.../src/....cpp). C/C++(1696)
cannot open source file "opencv2/core/mat.hpp" C/C++(1696)

Here is a screenshot of the same error:

enter image description here

My .vscode/c_cpp_properties.json file looks as follows:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "/opt/sdk/sysroots/corei7-64-poky-linux/usr/include/opencv2",
                "/opt/sdk/sysroots/corei7-64-poky-linux/usr/include/opencv2/core",
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "browse": {
                "path": [
                    "/opt/sdk/sysroots/corei7-64-poky-linux/usr/include/opencv2",
                    "/opt/sdk/sysroots/corei7-64-poky-linux/usr/include/opencv2/core",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}

And the mat.hpp file is clearly there:

$ ls /opt/sdk/sysroots/corei7-64-poky-linux/usr/include/opencv2/core | grep mat.hpp
mat.hpp

Still, Visual Studio Code does not pick it up. Why is that? What else should I change for Visual Studio Code to find my OpenCV header files?


Viewing all articles
Browse latest Browse all 99131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>