我使用本指南从源代码构建OpenCV。
https://linuxize.com/post/how-to-install-opencv-on-ubuntu-20-04/
现在我正在使用meson来构建和编译我的项目。我正在尝试使用两种不同的方法来将OpenCV包含在我的项目中,两种方法都可以。
方法一:cv2 = dependency('OpenCV', method: 'cmake')
方法二:cv2 = dependency('opencv4', required: true)
当我用介子编译时,我得到:
Dependency opencv4 found: YES 4.6.0 (cached)
Has header "opencv4/opencv2/bgsegm.hpp" : YES (cached)
Has header "opencv4/opencv2/calib3d.hpp" : YES (cached)
Has header "opencv4/opencv2/core.hpp" : YES (cached)
Has header "opencv4/opencv2/imgproc.hpp" : YES (cached)
Has header "opencv4/opencv2/objdetect.hpp" : YES (cached)
Has header "opencv4/opencv2/opencv.hpp" : YES (cached)
Has header "opencv4/opencv2/video.hpp" : YES (cached)
这很棒。
最后我使用:
lala = executable('lala','lala.cpp',
c_args : args,
include_directories : [includes_lala],
dependencies : [some_deps,cv2],
cpp_args : ['-g','-ggdb'],
link_with : some_lib )
但我收到了下一个错误:
In file included from ../src/lala.cpp:1:
../include/lala.hpp:16:10: fatal error: opencv2/opencv.hpp: No such file or directory
16 | #include "opencv2/opencv.hpp"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
我没有找到任何解决办法。谢谢!
1条答案
按热度按时间6kkfgxo01#
问题解决了。
我错过了一个应该包括OpenCV依赖项的可执行文件。
dependencies : [somestuff,cv2]
谢谢你的帮助!