编译FFMPEG错误对策
在MINGW32下编译ffmpeg-2.1.1.tar.bz2
step1: ./configure --prefix=/home/Administrator/install --extra-cflags=-I/home/Administrator/install/include --extra-ldflags=-L/home/Administrator/install/lib --enable-gpl --enable-version3 --enable-memalign-hack --enable-nonfree --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --enable-shared
step2: make
step3: make install
执行step2出现多处类型如下的报错:
D:\ProgramFile\MinGW\include\unistd.h:79:1: error: expected ',' or ';' before 'int'
int __mingw_sleep( unsigned long, unsigned long );
^
In file included from libavformat/file.c:26:0:
涉及的文件如下:
D:\ProgramFile\MinGW\msys\1.0\home\Administrator\source\ffmpeg-2.1.1\libavutil目录下 file.c file_open.c log.c random_seed.c time.c
D:\ProgramFile\MinGW\msys\1.0\home\Administrator\source\ffmpeg-2.1.1\libavformat目录下 cache.c file.c smoothstreamingenc.c
D:\ProgramFile\MinGW\msys\1.0\home\Administrator\source\ffmpeg-2.1.1\目录下 ffmpeg.c
对策:增加#include <windows.h>
将
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
修改成
#if HAVE_UNISTD_H
#include <windows.h>
#include <unistd.h>
#endif
----------------------------------------------------------------
./configure --prefix=/home/Administrator/install --extra-cflags=-I/home/Administrator/install/include --extra-ldflags=-L/home/Administrator/install/lib --enable-gpl --enable-version3 --enable-memalign-hack --enable-nonfree --disable-static --enable-shared --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --enable-bzlib --enable-zlib --enable-iconv --enable-libx264 --enable-libxavs --enable-libmp3lame --enable-libfaac --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb
改法1:将 #if CONFIG_ZLIB #include <zlib.h> #endif 修改成 #if CONFIG_ZLIB #include <windows.h> #include <zlib.h> #endif
改法2:在编译报错的地方增加添加#include <windows.h>
文件列表: D:\ProgramFile\MinGW\msys\1.0\home\Administrator\source\ffmpeg-2.1.1\libavformat目录下 id3v2.c matroskadec.c mov.c swdec.c swenc.c
D:\ProgramFile\MinGW\msys\1.0\home\Administrator\source\ffmpeg-2.1.1\libavcodec目录下 cscd.c dxa.c lcldec.c lclenc.c pngdec.c pngenc.c svq3.c tiff.c tiffenc.c tscc.c zmbv.c zmbvenc.c