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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值