gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 17:38:06 25 4
gpt4 key购买 nike

我下载了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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com