代码改变世界

ubuntu20.04 combile opencv 3.2.0(fix some problem)

2021-07-10 11:16  Eagel  阅读(90)  评论(0编辑  收藏  举报

Error in building opencv with ffmpeg

/home/coie/Softwares/Libraries/opencv-2.4.13.3/modules/highgui/src/cap_ffmpeg_impl.hpp:1484:21: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
         c->flags |= CODEC_FLAG_GLOBAL_HEADER;

 My solution is to grep the missing defines (2 in total) from FFmpeg by using grep -r which leads to the following code found in libavcodec/avcodec.h:

#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020

 GCC版本问题:编译找不到 math.h stdlib.h: fatal error: stdlib.h: No such file or director

Error compiling OpenCV, fatal error: stdlib.h: No such file or directory

cmake编译时报错:  stdlib.h
fatal error: stdlib.h: No such file or directory

解决方法3

关闭预编译头文件

cmake  . -DENABLE_PRECOMPILED_HEADERS=OFF