# Vscode can't find opencv head file recursively

**URL:** <https://forum.opencv.org/t/vscode-cant-find-opencv-head-file-recursively/15566>\
**Category:** C++\
**Tags:** vscode, programming\
**Created:** [November 18, 2023, 11:00am UTC](https://forum.opencv.org/t/vscode-cant-find-opencv-head-file-recursively/15566 "2023-11-18T11:00:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lenan](https://avatars.discourse-cdn.com/v4/letter/l/eada6e/32.png) [@lenan](https://forum.opencv.org/u/lenan)\
**Post date:** [November 18, 2023, 11:00am UTC](https://forum.opencv.org/t/vscode-cant-find-opencv-head-file-recursively/15566/1 "2023-11-18T11:00:28Z")

</div>

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:

```auto
"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:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/f/fd7b72b9d44eebe5a45fe6edd539f9b00e64888e.png)
