I got 'fatal error: opencv2/core.hpp: No such file or directory' but there is it

I got 'fatal error: opencv2/core.hpp: No such file or directory' but there is it

我正在尝试在 C++ 上使用 opencv 4.x 库。

当我运行在vscode上测试代码时,出现错误'fatal error: opencv2/core.hpp: No such file or directory'

但是目录里有文件

我检查了 vscode 的 json 文件并正确设置了包含路径。不知道为什么。

你能告诉我我错过了什么吗?

{
"configurations": [
    {
        "name": "Win32",
        "includePath": [
            "${workspaceFolder}/**",
            "C:\minGW+opencv\opencv\build\include"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "windowsSdkVersion": "10.0.18362.0",
        "compilerPath": "C:/minGW+opencv/minGW/bin/g++.exe",
        "cStandard": "c17",
        "cppStandard": "c++17",
        "intelliSenseMode": "windows-gcc-x64"
    }
],
"version": 4

}

我在正确的路径中有那个头文件。

C:\minGW+opencv\opencv\build\include 是您项目的错误包含路径。 (它只包含 cmake 脚本,没有实际的 headers)

假设你之前做了一个正确的mingw32-make install(好吧,做了你??),它应该是:

C:\minGW+opencv\opencv\build\install\include