opencv - 严重错误:zbar.h:没有此类文件或目录

标签 opencv cmake zbar

我下载了zbar库,并将opencv-zbar存储库克隆到我的主目录中。然后我运行了以下命令$cmake .,给了我错误

-- Could NOT find ZBAR (missing:  ZBAR_LIBRARIES ZBAR_INCLUDE_DIR) 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZBAR_LIBRARIES
    linked by target "zbar_opencv" in directory /home/surabhi/opencv-zbar

-- Configuring incomplete, errors occurred!
See also "/home/surabhi/opencv-zbar/CMakeFiles/CMakeOutput.log".


然后,我在CMakeCache.txt中进行了两个更改,如下所示
//Path to a file.
ZBAR_INCLUDE_DIR:PATH=/usr/include/zbar

//Path to a library.
ZBAR_LIBRARIES:FILEPATH=/usr/lib/libzbar.so

因为设置为NOTFOUND

然后没有错误

-- Found ZBAR: /usr/lib/libzbar.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/surabhi/opencv-zbar


但是当我运行make

它给出了错误:

fatal error: zbar.h: No such file or directory
 #include <zbar.h>
                  ^
compilation terminated.


我不明白为什么会收到此错误,因为它说当我运行cmake时发现了ZBAR

提前致谢

最佳答案

您实际上需要在CMakeLists.txt中的某处实际使用include dirs,以便CMake知道您实际上要使用这些include路径。

例子:
include_directories(${ZBAR_INCLUDE_DIR})
或更现代的推荐方式:
target_include_directories(zbar_opencv PRIVATE ${ZBAR_INCLUDE_DIR})

关于opencv - 严重错误:zbar.h:没有此类文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48163369/

相关文章:

python - 我正在尝试使用cv2.projectPoints(),但出现错误

使用不同的CFLAGS为不同的目标编译通用的C文件

c++ - 如何解决 mac 中的 qt5(未找到软件包)cmake 错误?

opencv - 如果 OpenCV 使用 CUDA 编译,如何在 CMAKE 文件中查找

Python + OpenCV = 如何画出麦田圈?

opencv - PIL 和 opencv 显示来自同一图像的不同图像背景

qt - 为什么编译为 .so 的 Qt 插件在部署在 MacOSX bundle 中时不起作用?

ios - Zbar条形码阅读器无法正确扫描ipod touch 4G的code128格式条形码

ios - 仅从图像扫描 zbar 条形码,无 ImageView 或相机胶卷

ios - ZBar:架构 armv7 的 undefined symbol