[英]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.