<p dir="auto"><strong>HEAD</strong>: I rewrite my issue for people who search for c++ include error solution.</p>
<p dir="auto">Opencv4 (version 4.x.x) (building from source for linux) move include files in /usr/local/include/<strong>opencv4/opencv2</strong>/...<br>
The problem is lot of opencv modules are including <strong>&lt;opencv2/</strong>...&gt; which make error while compiling.<br>
Yes, I know that is very difficult to change all includes in modules, but you can change it in the Makefile.</p>
<p dir="auto">Of course, this is just a recommendation for your project, for me, I resolved the problem by executing this commands:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mv /usr/local/include/opencv4/opencv2 /usr/local/include/.
rm -rf /usr/local/include/opencv4"><pre class="notranslate">mv /usr/local/include/opencv4/opencv2 /usr/local/include/.
rm -rf /usr/local/include/opencv4</pre></div>
<p dir="auto">Thanks Developers <g-emoji class="g-emoji" alias="1st_place_medal" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f947.png">🥇</g-emoji> !</p>
<p dir="auto"><strong>EDIT</strong>: I found a new problem while compiling a simple opencv project which read image and display it. And I found a resolution for this error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# I make an opencv.pc file which it can be read by pkg-config in linux
cat &gt; /usr/lib/pkgconfig/opencv.pc &lt;&lt; EOF
# Package Information for pkg-config

prefix=/usr
exec_prefix=${prefix}/local
libdir=${prefix}/lib
includedir=${exec_prefix}/include/opencv2

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 4.5.1
Libs: -L${libdir} -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core
Libs.private: -ldl -lm -lpthread -lrt
Cflags: -I${includedir}
EOF"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span> I make an opencv.pc file which it can be read by pkg-config in linux</span>
cat <span class="pl-k">&gt;</span> /usr/lib/pkgconfig/opencv.pc <span class="pl-s"><span class="pl-k">&lt;&lt;</span> <span class="pl-k">EOF</span></span>
<span class="pl-s"># Package Information for pkg-config</span>
<span class="pl-s"></span>
<span class="pl-s">prefix=/usr</span>
<span class="pl-s">exec_prefix=<span class="pl-smi">${prefix}</span>/local</span>
<span class="pl-s">libdir=<span class="pl-smi">${prefix}</span>/lib</span>
<span class="pl-s">includedir=<span class="pl-smi">${exec_prefix}</span>/include/opencv2</span>
<span class="pl-s"></span>
<span class="pl-s">Name: OpenCV</span>
<span class="pl-s">Description: Open Source Computer Vision Library</span>
<span class="pl-s">Version: 4.5.1</span>
<span class="pl-s">Libs: -L<span class="pl-smi">${libdir}</span> -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core</span>
<span class="pl-s">Libs.private: -ldl -lm -lpthread -lrt</span>
<span class="pl-s">Cflags: -I<span class="pl-smi">${includedir}</span></span>
<span class="pl-s"><span class="pl-k">EOF</span></span></pre></div>
<p dir="auto">I made a full automation script shell in my <a href="https://github.com/Seven-7Up/opencv-installerForLinux/">repo</a>. Check it later if you like.</p>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 4.0.0-rc</li>
<li>Operating System / Platform =&gt; Ubuntu 18.10</li>
<li>Compiler =&gt; gcc 8.2.0 / gcc 6</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I did cmake ...Then make and then make install<br>
and it does not generate opencv.pc file.</p>
<p dir="auto">If I use same commands for version 3.4.3 then the file is created.</p>
<p dir="auto">Another thing<br>
if I link with pkgconfig then it links to librarys with no version numbers.<br>
so installing 4.0.0-rc after 3.4.3 makes pkgconfig unusable.<br>
it would be nice if there were multiple opencv.pc files like opencv3.4.pc opencv4.pc</p>