# Can#t compile cpp samples on raspi 4

**URL:** <https://forum.opencv.org/t/can-t-compile-cpp-samples-on-raspi-4/4354>\
**Category:** C++\
**Tags:** build\
**Created:** [July 15, 2021, 2:33pm UTC](https://forum.opencv.org/t/can-t-compile-cpp-samples-on-raspi-4/4354 "2021-07-15T14:33:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/michael/32/2686_2.png) [@michael](https://forum.opencv.org/u/michael)\
**Post date:** [July 15, 2021, 2:33pm UTC](https://forum.opencv.org/t/can-t-compile-cpp-samples-on-raspi-4/4354/1 "2021-07-15T14:33:48Z")

</div>

Hi,  
I built the opencv successfully. But when I try

g++ opencv\_version.cpp -I ~/opencvbuild/include/  
opencv\_version.cpp:5:10: fatal error: opencv2/core/utility.hpp: Datei oder Verzeichnis nicht gefunden  
#include \<opencv2/core/utility.hpp\>

it doesn’t find utility.cp - when I specify full path it doesn’t find opencv2/core.hpp

how to set up includes correctly ?

br mike

---

<div class="post-metadata">

**Author:** ![kbarni](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kbarni/32/26_2.png) [@kbarni](https://forum.opencv.org/u/kbarni)\
**Post date:** [July 16, 2021, 8:58am UTC](https://forum.opencv.org/t/can-t-compile-cpp-samples-on-raspi-4/4354/2 "2021-07-16T08:58:36Z")

</div>

If OpenCV is successfully built, you should install it using `sudo make install` and `sudo ldconfig`.  
Then, use the system path `-I/usr/local/include/opencv4`

If OpenCV was built with pkg-config support, you can use it too:

```
g++ mycode.cpp -o mycode $(shell pkg-config opencv4 --cflags) $(shell pkg-config opencv4 --ldflags)
```

---

<div class="post-metadata">

**Author:** ![michael](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/michael/32/2686_2.png) [@michael](https://forum.opencv.org/u/michael)\
**Post date:** [July 26, 2021, 2:09pm UTC](https://forum.opencv.org/t/can-t-compile-cpp-samples-on-raspi-4/4354/3 "2021-07-26T14:09:58Z")

</div>

thanks a lot !!! now it works !!!
