问题:make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o] 错误 1[ 17%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o In file included from /usr/include/jasper/jasper.h:77:0, from /usr/local/opencv-2.4.9/modules/highgui/src/grfmt_jpeg2000.cpp:58: /usr/include/jasper/jas_math.h: 在函数‘bool jas_safe_size_mul(size_t, size_t, size_t*)’中: /usr/include/jasper/jas_math.h:143:15: 错误:‘SIZE_MAX’在此作用域中尚未声明 if (x && y > SIZE_MAX / x) { ^ /usr/include/jasper/jas_math.h: 在函数‘bool jas_safe_size_add(size_t, size_t, size_t*)’中: /usr/include/jasper/jas_math.h:170:10: 错误:‘SIZE_MAX’在此作用域中尚未声明 if (y > SIZE_MAX - x) { ^ 在全局域: cc1plus: 警告:无法识别的命令行选项“-Wno-unnamed-type-template-args” [默认启用] make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o] 错误 1 make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2 make: *** [all] 错误 2
错误原因:2017年5月15日,centos更新了jaspe-devel包为jasper-devel.x86_64 0:1.900.1-30.el7_3(旧版本为jasper-devel-1.900.1-29.el7.x86_64)解决方案:vi /usr/include/jasper/jas_math.h#在 #include后添加
#ifndef SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif