0

Screenshot

I've installed Opencv4 via homebrew. And set up everything for the C++ program. Even in the program, I got the headers file's

enter image description here

suggestion from OpenCV. But when I execute the program. fatal error: 'opencv2/opencv.hpp' file not found error occurs.

I try my best to fix but still stuck. Hope someone can help me out!

task.json file:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++17",
                "-stdlib=libc++",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
MaxV
  • 2,358
  • 3
  • 16
  • 22
JayJay
  • 308
  • 3
  • 13
  • Inside of `/usr/local/Cellar/opecv/4.4.0_1/include/opencv4` is there a `opencv2` folder? If there is not maybe the correct folder is `/usr/local/Cellar/opecv/4.4.0_1/include` – drescherjm Sep 04 '20 at 17:12
  • There is also `tasks.json` that needs configured. – drescherjm Sep 04 '20 at 17:15
  • @drescherjm yes, there is. – JayJay Sep 04 '20 at 17:16
  • I expect your bug is in `tasks.json` – drescherjm Sep 04 '20 at 17:17
  • @drescherjm in launch.json and task.json I've configured both that following on the internet. – JayJay Sep 04 '20 at 17:18
  • You should add the text of `tasks.json` to your question. Please no pictures of text. – drescherjm Sep 04 '20 at 17:24
  • @drescherjm yep, I've added. – JayJay Sep 04 '20 at 17:37
  • The bug is in the ` "args": ` part your code does not set the include path for the compiler. c_cpp_properties.json is for intellisense not the compiler. Related: [https://stackoverflow.com/questions/52910102/vscode-c-task-json-include-path-and-libraries](https://stackoverflow.com/questions/52910102/vscode-c-task-json-include-path-and-libraries) – drescherjm Sep 04 '20 at 17:38
  • @drescherjm ohh... Thank you for pointing this out! the problem was solved. Thank you so much :). – JayJay Sep 04 '20 at 17:50

0 Answers0