What to do if the core file does not contain private.hpp?

I am trying to make a program that will detect and recognize faces but it says that no such file or directory of private.hpp in core file.

you probably setup your compiler includes in a wrong way,
should use:

#include "opencv2/opencv.hpp"

and

-I /usr/local/include/opencv4

Firstly, confirm that include paths is correct and reinstall the library, avoid using internal headers, update to the latest version and use the correct public headers.