作者:夏欣晴 | 来源:互联网 | 2023-02-03 16:38
我下载opencv-3.0.0.zip并解压缩,然后执行:
#cd opencv-3.0.0/
#mkdir build
#cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=./build -D WITH_IPP=OFF ../opencv-3.0.0
#make -j8
它会产生一些错误:
……
[ 49%] Building CXX object
modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000.cpp.o
In file included from /usr/include/jasper/jasper.h:77:0,
from /home/apps/zhimin.feng/software/opencv-3.0.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp:59:
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_mul(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:143:15: error: ‘SIZE_MAX’ was not declared in this scope
if (x && y > SIZE_MAX / x) {
^
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_add(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:170:10: error: ‘SIZE_MAX’ was not declared in this scope
if (y > SIZE_MAX - x) {
^
make[2]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000.cpp.o] Error 1
make[1]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
我可能已经安装了所有依赖项,但它仍然会出现错误.
1> zhimin.feng..:
我终于找到了答案
尝试在raspbian wheezy上构建opencv-2.4.10时未声明SIZE_MAX
编辑/usr/include/jasper/jas_math.h,add
#if ! defined SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif
后
#include