简体   繁体   English

严重错误:zbar.h:没有这样的文件或目录

[英]fatal error: zbar.h: No such file or directory

I downloaded the zbar library and cloned the opencv-zbar repo in my home directory. 我下载了zbar库,并将opencv-zbar存储库克隆到我的主目录中。 Then I ran the following command $cmake . 然后我运行以下命令$cmake . which gave my the error 这给了我错误

 -- 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". 

I then made two changes in my CMakeCache.txt as follows 然后,我在CMakeCache.txt中进行了两个更改,如下所示

//Path to a file.
ZBAR_INCLUDE_DIR:PATH=/usr/include/zbar

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

because the were set to NOTFOUND . 因为设置为NOTFOUND

It then gave me no errors 然后没有错误

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

But when I run make 但是当我运行make

It gives the error: 它给出了错误:

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

I don't understand why I get this error as It says Found ZBAR when I run cmake . 我不明白为什么会收到此错误,因为运行cmake时显示Found ZBAR

Thanks in advance 提前致谢

You need to do actually use the include dirs somewhere in your CMakeLists.txt so CMake knows that you actually want to use these include paths. 您实际上需要在CMakeLists.txt中的某个位置实际使用包含目录,因此CMake知道您实际上是想使用这些包含路径。

Examples: 例子:

include_directories(${ZBAR_INCLUDE_DIR})

Or the more modern, recommended way: 或更现代的推荐方式:

target_include_directories(zbar_opencv PRIVATE ${ZBAR_INCLUDE_DIR})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译 OpenCV 时出错,致命错误:stdlib.h: No such file or directory - Error compiling OpenCV, fatal error: stdlib.h: No such file or directory 致命错误:opencv / cvtypes.h:没有终止此类文件或目录的编译 - fatal error: opencv/cvtypes.h: No such file or directory compilation terminated 严重错误C1083:无法打开包含文件:&#39;opencv2 / opencv.h&#39;:没有此类文件或目录 - fatal error C1083: Cannot open include file: 'opencv2/opencv.h': No such file or directory 致命错误:opencv2 / core / core_c.h:没有这样的文件或目录 - fatal error: opencv2/core/core_c.h: No such file or directory OpenCV 错误 zlib.h:没有这样的文件或目录 - OpenCV error zlib.h: no such file or directory 致命错误:安装时找不到“Python.h”文件 opencv - fatal error: 'Python.h' file not found while installing opencv Tesseract-ocr,baseapi.h 致命错误:找不到 platform.h 文件 - Tesseract-ocr, baseapi.h fatal error: platform.h file not found 致命错误:opencv2/xfeatures2d.hpp:没有那个文件或目录 - fatal error: opencv2/xfeatures2d.hpp: No such file or directory 致命错误:opencv2 / nonfree / nonfree.hpp:没有这样的文件或目录 - fatal error: opencv2/nonfree/nonfree.hpp: No such file or directory 已解决 - c++ 的 Sublime 文本中的“致命错误:opencv:没有这样的文件或目录” - SOLVED - “fatal error: opencv: no such file or directory” in Sublime Text for c++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM