2017-01-28 5 views
1

Я пытаюсь построить opencv-2.4.10 на моей модели Raspberry Pi B (wheezy) после these instructions, но я получаю ошибку ниже. Каков наилучший способ исправить это?SIZE_MAX не объявляется при попытке построить opencv-2.4.10 на raspbian wheezy

[ 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

ответ

4

Я не уверен, если его лучшая практика, но после попытки исправить путем определения __STDC_LIMIT_MACROS, я сдалась и редактировать /usr/include/jasper/jas_math.h, добавив

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

сразу после

#include <stdint.h> 
+0

Это, конечно, не лучшая практика ... это было бы представить решение вернуться к (предполагается, с открытым исходным кодом), корень проблемы. Но я признаю это обычной практикой :-) – Gavin

+0

Это нехорошо. [Как получить SIZE_MAX в C89] (https://stackoverflow.com/q/44401965/995714) –