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!

"args": [
                "-I", "D:\\opencv\\build\\install\\include",
                "-L", "D:\\opencv\\build\\install\\x64\\mingw\\bin",
                // "-std=c++14"