Vscode can't find opencv head file recursively

Hello everyone,

I’m new to OpenCV and I’ve successfully installed it and modified my task.json file. However, I’m encountering an issue when compiling my code. The error message I receive is: fatal error: opencv2\opencv.hpp: No such file or directory.

To address this, I tried using the absolute path D:/opencv/build/install/include/opencv2/opencv.hpp. Unfortunately, this led to another error: D:/opencv/build/install/include/opencv2/opencv.hpp:48:10: fatal error: opencv2/opencv_modules.hpp: No such file or directory.

I attempted to resolve this by modifying #include "opencv2/opencv_modules.hpp" in opencv.hpp to an absolute path. However, I quickly realized that all header files included in opencv.hpp would need to be changed to absolute paths, which doesn’t seem like the correct approach.

I’m quite confused and would appreciate any guidance on how to solve this problem. For reference, I’ve included my task.json file and the paths of OpenCV below.

Thank you in advance for your help!
task.json:

"args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "-I", "D:\\opencv\\build\\install\\include",
                "-L", "D:\\opencv\\build\\install\\x64\\mingw\\bin",
                "-lopencv_core470",
                "-lopencv_imgcodecs470",
                "-lopencv_imgproc470",
                "-lopencv_calib3d470",
                "-lopencv_dnn470",
                "-lopencv_features2d470",
                "-lopencv_flann470",
                "-lopencv_gapi470",
                "-lopencv_highgui470",
                "-lopencv_ml470",
                "-lopencv_objdetect470",
                "-lopencv_photo470",
                "-lopencv_stitching470",
                "-lopencv_video470",
                "-lopencv_videoio470",
                "-fdiagnostics-color=always"
                // "-std=c++14"
            ],

directory: