ZoneMinder 编译错误:“标记“(”之前缺少二元运算符”

ZoneMinder 编译错误:“标记“(”之前缺少二元运算符”

在CentOS 6.4(64位)中安装ZoneMinder 1.25.0时,执行时会弹出以下错误make

zm_ffmpeg_camera.cpp:105:44: 错误: 标记“(”之前缺少二元运算符

完整日志:

zm_ffmpeg_camera.cpp:105:44: error: missing binary operator before token "("
In file included from zm_ffmpeg_camera.cpp:24:
zm_ffmpeg_camera.h:39: error: ISO C++ forbids declaration of ‘AVFormatContext’ with no type
zm_ffmpeg_camera.h:39: error: expected ‘;’ before ‘*’ token
zm_ffmpeg_camera.h:41: error: ISO C++ forbids declaration of ‘AVCodecContext’ with no type
zm_ffmpeg_camera.h:41: error: expected ‘;’ before ‘*’ token
zm_ffmpeg_camera.h:42: error: ISO C++ forbids declaration of ‘AVCodec’ with no type
zm_ffmpeg_camera.h:42: error: expected ‘;’ before ‘*’ token
zm_ffmpeg_camera.h:44: error: ISO C++ forbids declaration of ‘AVFrame’ with no type
zm_ffmpeg_camera.h:44: error: expected ‘;’ before ‘*’ token
zm_ffmpeg_camera.h:45: error: ISO C++ forbids declaration of ‘AVFrame’ with no type
zm_ffmpeg_camera.h:45: error: expected ‘;’ before ‘*’ token
zm_ffmpeg_camera.cpp: In constructor ‘FfmpegCamera::FfmpegCamera(int, const std::string&, int, int, int, int, int, int, int, bool)’:
zm_ffmpeg_camera.cpp:35: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:37: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:38: error: ‘mCodec’ was not declared in this scope
zm_ffmpeg_camera.cpp:40: error: ‘mRawFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:41: error: ‘mFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp: In destructor ‘virtual FfmpegCamera::~FfmpegCamera()’:
zm_ffmpeg_camera.cpp:46: error: ‘mFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:46: error: ‘av_freep’ was not declared in this scope
zm_ffmpeg_camera.cpp:47: error: ‘mRawFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:51: error: ‘sws_freeContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:54: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:56: error: ‘avcodec_close’ was not declared in this scope
zm_ffmpeg_camera.cpp:59: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:61: error: ‘av_close_input_file’ was not declared in this scope
zm_ffmpeg_camera.cpp: In member function ‘void FfmpegCamera::Initialise()’:
zm_ffmpeg_camera.cpp:78: error: ‘AV_LOG_DEBUG’ was not declared in this scope
zm_ffmpeg_camera.cpp:78: error: ‘av_log_set_level’ was not declared in this scope
zm_ffmpeg_camera.cpp:80: error: ‘AV_LOG_QUIET’ was not declared in this scope
zm_ffmpeg_camera.cpp:80: error: ‘av_log_set_level’ was not declared in this scope
zm_ffmpeg_camera.cpp:82: error: ‘av_register_all’ was not declared in this scope
zm_ffmpeg_camera.cpp: In member function ‘virtual int FfmpegCamera::PrimeCapture()’:
zm_ffmpeg_camera.cpp:94: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:94: error: ‘av_open_input_file’ was not declared in this scope
zm_ffmpeg_camera.cpp:95: error: ‘errno’ was not declared in this scope
zm_ffmpeg_camera.cpp:98: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:98: error: ‘av_find_stream_info’ was not declared in this scope
zm_ffmpeg_camera.cpp:99: error: ‘errno’ was not declared in this scope
zm_ffmpeg_camera.cpp:103: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:108: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope
zm_ffmpeg_camera.cpp:118: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:118: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:121: error: ‘mCodec’ was not declared in this scope
zm_ffmpeg_camera.cpp:121: error: ‘avcodec_find_decoder’ was not declared in this scope
zm_ffmpeg_camera.cpp:125: error: ‘mCodec’ was not declared in this scope
zm_ffmpeg_camera.cpp:125: error: ‘avcodec_open’ was not declared in this scope
zm_ffmpeg_camera.cpp:129: error: ‘mRawFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:129: error: ‘avcodec_alloc_frame’ was not declared in this scope
zm_ffmpeg_camera.cpp:132: error: ‘mFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:135: error: ‘PIX_FMT_RGB24’ was not declared in this scope
zm_ffmpeg_camera.cpp:135: error: ‘avpicture_get_size’ was not declared in this scope
zm_ffmpeg_camera.cpp:138: error: ‘AVPicture’ was not declared in this scope
zm_ffmpeg_camera.cpp:138: error: expected primary-expression before ‘)’ token
zm_ffmpeg_camera.cpp:138: error: ‘avpicture_fill’ was not declared in this scope
zm_ffmpeg_camera.cpp:141: error: ‘SWS_BICUBIC’ was not declared in this scope
zm_ffmpeg_camera.cpp:141: error: ‘sws_getCachedContext’ was not declared in this scope
zm_ffmpeg_camera.cpp: In member function ‘virtual int FfmpegCamera::Capture(Image&)’:
zm_ffmpeg_camera.cpp:159: error: ‘AVPacket’ was not declared in this scope
zm_ffmpeg_camera.cpp:159: error: expected ‘;’ before ‘packet’
zm_ffmpeg_camera.cpp:163: error: ‘mFormatContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:163: error: ‘packet’ was not declared in this scope
zm_ffmpeg_camera.cpp:163: error: ‘av_read_frame’ was not declared in this scope
zm_ffmpeg_camera.cpp:172: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:172: error: ‘mRawFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:172: error: ‘avcodec_decode_video2’ was not declared in this scope
zm_ffmpeg_camera.cpp:182: error: ‘mRawFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:182: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:182: error: ‘mFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:182: error: ‘sws_scale’ was not declared in this scope
zm_ffmpeg_camera.cpp:188: error: ‘mCodecContext’ was not declared in this scope
zm_ffmpeg_camera.cpp:188: error: ‘mFrame’ was not declared in this scope
zm_ffmpeg_camera.cpp:193: error: ‘av_free_packet’ was not declared in this scope
make[2]: *** [zm_ffmpeg_camera.o] Error 1
make[2]: Leaving directory `/root/cam/ZoneMinder-1.25.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/cam/ZoneMinder-1.25.0'
make: *** [all] Error 2

答案1

结果发现最新的 ffmpeg 稳定版本 (1.2.2) 与 ZoneMinder 1.25.0 不兼容。

安装0.9版本的ffmpeg解决了这个问题。

wget http://www.ffmpeg.org/releases/ffmpeg-0.9.tar.gz
tar -xzvf ffmpeg-0.9.tar.gz
cd ffmpeg-0.9
./configure --enable-gpl --enable-shared --enable-pthreads
make
make install
make install-libs

相关内容