【问题标题】:SIZE_MAX not declared when trying to build opencv-2.4.10 on raspbian wheezy尝试在 raspbian wheezy 上构建 opencv-2.4.10 时未声明 SIZE_MAX
【发布时间】:2017-06-14 09:26:06
【问题描述】:

我正在尝试在 these instructions 之后在我的 Raspberry Pi 模型 B (wheezy) 上构建 opencv-2.4.10,但出现以下错误。解决此问题的最佳方法是什么?

[ 14%] 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 /home/pi/opencv-2.4.10/modules/highgui/src/grfmt_jpeg2000.cpp:58: /usr/include/jasper/jas_math.h: In function ‘int jas_safe_size_mul(size_t, size_t, size_t*)’: /usr/include/jasper/jas_math.h:117:22: error: ‘SIZE_MAX’ was not declared in this scope modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:422: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o' failed make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o] Error 1 CMakeFiles/Makefile2:1772: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 Makefile:133: recipe for target 'all' failed make: *** [all] Error 2

【问题讨论】:

    标签: opencv raspbian-wheezy


    【解决方案1】:

    我不确定它是否是最佳实践,但在尝试通过定义 __STDC_LIMIT_MACROS 进行纠正后,我放弃并编辑了 /usr/include/jasper/jas_math.h,添加了

    #if ! defined SIZE_MAX
    #define SIZE_MAX (4294967295U)
    #endif
    

    紧接着

    #include <stdint.h>
    

    【讨论】:

    • 这当然不是最佳实践......这将提交一个解决方案返回到问题的(假设是开源的)根源。但我认为这是常见的做法:-)
    • 这不是一个好方法。 How to get SIZE_MAX in C89
    猜你喜欢
    • 2015-06-25
    • 2012-06-12
    • 1970-01-01
    • 2014-02-01
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多