# Opencv\_modules.hpp not generated when building from source

**URL:** <https://forum.opencv.org/t/opencv-modules-hpp-not-generated-when-building-from-source/2851>\
**Category:** C++\
**Tags:** build\
**Created:** [April 19, 2021, 9:13pm UTC](https://forum.opencv.org/t/opencv-modules-hpp-not-generated-when-building-from-source/2851 "2021-04-19T21:13:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Videet\_Parekh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/_videet_parekh/32/1858_2.png) [@\_Videet\_Parekh](https://forum.opencv.org/u/_Videet_Parekh)\
**Post date:** [April 19, 2021, 9:13pm UTC](https://forum.opencv.org/t/opencv-modules-hpp-not-generated-when-building-from-source/2851/1 "2021-04-19T21:13:30Z")

</div>

I’m building openCV using the following instructions:

```
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..

make -j8
sudo make install
sudo ldconfig

```

The build is successful, but when running a hello world example:

```
#include "opencv2/opencv.hpp"
int main() {
    cout >> "Hello World";
    return 0;
}

```

and compiling it with  
`gcc -Iopencv/include helloworld.cpp -o hw.exe`

I get the following error:

```
OpenCV/include/opencv2/opencv.hpp:48:10: fatal error: opencv2/opencv_modules.hpp: No such file or directory
   48 | #include "opencv2/opencv_modules.hpp"
      | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~

```

My belief is the make commands should be creating an `opencv_modules.hpp` file tat lays the paths out to the rest of the dependencies, but this file is not being generated in my case. How can I fix this?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [April 20, 2021, 2:13am UTC](https://forum.opencv.org/t/opencv-modules-hpp-not-generated-when-building-from-source/2851/2 "2021-04-20T02:13:03Z")

</div>

- exact opencv version ?
- did you run a proper `make install` ?

> [@\_Videet\_Parekh](#):
>
> -Iopencv/include

looks like it is pointing into the _src_ folder (wrong), not where you _installed_ it.

(proper location for 4.x on linux would be: `/usr/local/include/opencv4`)

---

<div class="post-metadata">

**Author:** ![\_Videet\_Parekh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/_videet_parekh/32/1858_2.png) [@\_Videet\_Parekh](https://forum.opencv.org/u/_Videet_Parekh)\
**Post date:** [April 21, 2021, 3:55pm UTC](https://forum.opencv.org/t/opencv-modules-hpp-not-generated-when-building-from-source/2851/3 "2021-04-21T15:55:03Z")

</div>

Thanks @berak , you were right. My install was fine, and I expected the files to be generated in the OpenCV source folder itself. Fixed by changing include reference to  
`-I/usr/local/include/opencv4`.
