Can#t compile cpp samples on raspi 4

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

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)
1 Like

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