Ubuntu 18.04LTS opencv make error solution

  1. Error1:Scanning dependencies of target opencv_test_core
    [ 22%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_arithm.cpp.o
    [ 22%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_channels.cpp.o
    [ 22%] Building CXX object modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_dft.cpp.o
    ^Cmodules/core/CMakeFiles/opencv_test_core.dir/build.make:110: recipe for target ‘modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_dft.cpp.o’ failed
    make[2]: *** [modules/core/CMakeFiles/opencv_test_core.dir/test/ocl/test_dft.cpp.o] 中斷
    CMakeFiles/Makefile2:2670: recipe for target ‘modules/core/CMakeFiles/opencv_test_core.dir/all’ failed
    make[1]: *** [modules/core/CMakeFiles/opencv_test_core.dir/all] 中斷
    Makefile:162: recipe for target ‘all’ failed
    make: *** [all] 中斷

查看 Cmakeerrorlog.txt, 缺少 videoio.h文件,於是 在opencv中搜索到videoio.hpp文件複製到usr/include/下,並更名爲videoio.h
2.Error2:[ 53%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/seam_finders.cpp.o
[ 53%] Building CXX object modules/stitching/CMakeFiles/opencv_stitching.dir/src/motion_estimators.cpp.o
[ 53%] Building CXX object apps/createsamples/CMakeFiles/opencv_createsamples.dir/createsamples.cpp.o
In file included from /home/hbj/下載/opencvgit/opencv/modules/stitching/src/matchers.cpp:52:0:
/home/hbj/opencv_contrib/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp:963:92: error: ‘cv::FastFeatureDetector::DetectorType’ has not been declared
int threshold, bool nonmaxSuppression=true, cv::FastFeatureDetector::DetectorType type=FastFeatureDetector::TYPE_9_16);
^~~~~~~~~~~~
modules/stitching/CMakeFiles/opencv_stitching.dir/build.make:164: recipe for target ‘modules/stitching/CMakeFiles/opencv_stitching.dir/src/matchers.cpp.o’ failed
make[2]: *** [modules/stitching/CMakeFiles/opencv_stitching.dir/src/matchers.cpp.o] Error 1
make[2]: *** 正在等待未完成的任務…

在 /home/hbj/下載/opencvgit/opencv/modules/stitching/src/matchers.cpp中增加兩句:
#include “/home/hbj/下載/opencvgit/opencv/include/opencv2/xfeatures2d.hpp”
#include “/home/hbj/下載/opencvgit/opencv/include/opencv2/nonfree.hpp”
並從opencv文件夾下複製這兩個頭文件至指定目錄即可。
編譯通過:
[ 99%] Built target example_tapi_hog
Scanning dependencies of target example_tapi_opencl_custom_kernel
[ 99%] Building CXX object samples/tapi/CMakeFiles/example_tapi_opencl_custom_kernel.dir/opencl_custom_kernel.cpp.o
[ 99%] Linking CXX executable …/…/bin/example_tapi_opencl_custom_kernel
[ 99%] Built target example_tapi_opencl_custom_kernel
Scanning dependencies of target example_tapi_camshift
[ 99%] Building CXX object samples/tapi/CMakeFiles/example_tapi_camshift.dir/camshift.cpp.o
[ 99%] Linking CXX executable …/…/bin/example_tapi_camshift
[ 99%] Built target example_tapi_camshift
Scanning dependencies of target example_tapi_bgfg_segm
[ 99%] Building CXX object samples/tapi/CMakeFiles/example_tapi_bgfg_segm.dir/bgfg_segm.cpp.o
[ 99%] Linking CXX executable …/…/bin/example_tapi_bgfg_segm
[ 99%] Built target example_tapi_bgfg_segm
Scanning dependencies of target example_tapi_dense_optical_flow
[100%] Building CXX object samples/tapi/CMakeFiles/example_tapi_dense_optical_flow.dir/dense_optical_flow.cpp.o
[100%] Linking CXX executable …/…/bin/example_tapi_dense_optical_flow
[100%] Built target example_tapi_dense_optical_flow
Scanning dependencies of target example_tapi_pyrlk_optical_flow
[100%] Building CXX object samples/tapi/CMakeFiles/example_tapi_pyrlk_optical_flow.dir/pyrlk_optical_flow.cpp.o
[100%] Linking CXX executable …/…/bin/example_tapi_pyrlk_optical_flow
[100%] Built target example_tapi_pyrlk_optical_flow
Scanning dependencies of target example_tapi_squares
[100%] Building CXX object samples/tapi/CMakeFiles/example_tapi_squares.dir/squares.cpp.o
[100%] Linking CXX executable …/…/bin/example_tapi_squares
[100%] Built target example_tapi_squares
Scanning dependencies of target example_tapi_ufacedetect
[100%] Building CXX object samples/tapi/CMakeFiles/example_tapi_ufacedetect.dir/ufacedetect.cpp.o
[100%] Linking CXX executable …/…/bin/example_tapi_ufacedetect
[100%] Built target example_tapi_ufacedetect
[100%] Built target example_opengl_opengl
[100%] Built target example_opengl_opengl_interop

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章