Windows下使用MinGW+msys编译FFmpeg错误

来源:互联网 发布:专业的vb振动电机 编辑:程序博客网 时间:2024/05/01 19:37
In file included from libavformat/hlsenc.c:26:0:
c:\mingw\include\unistd.h:79:1: error: expected ',' or ';' before 'int'
 int __mingw_sleep( unsigned long, unsigned long );
 ^
In file included from libavformat/hlsenc.c:26:0:
c:\mingw\include\unistd.h:105:1: error: expected ',' or ';' before 'int'
 int nanosleep( const struct timespec *, struct timespec * );
 ^
c:\mingw\include\unistd.h:125:28: error: expected ',' or ';' before 'usleep'
 int _cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
                            ^
c:\mingw\include\unistd.h:138:10: error: conflicting types for '_cdecl'
 unsigned _cdecl __MINGW_NOTHROW sleep( unsigned );
          ^
c:\mingw\include\unistd.h:125:5: note: previous declaration of '_cdecl' was here


 int _cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
     ^
c:\mingw\include\unistd.h:138:33: error: expected ',' or ';' before 'sleep'
 unsigned _cdecl __MINGW_NOTHROW sleep( unsigned );
                                 ^
c:\mingw\include\unistd.h:153:12: error: expected '=', ',', ';', 'asm' or '__att
ribute__' before 'ftruncate'
 int _cdecl ftruncate( int, off_t );
            ^
libavformat/hlsenc.c: In function 'hls_window':
libavformat/hlsenc.c:271:5: warning: format '%d' expects argument of type 'int',
 but argument 3 has type 'int64_t' [-Wformat=]
     avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
     ^
libavformat/hlsenc.c:274:12: warning: format '%d' expects argument of type 'int'
, but argument 4 has type 'int64_t' [-Wformat=]
            sequence);
            ^
libavformat/hlsenc.c:280:26: warning: format '%i' expects argument of type 'int'
, but argument 3 has type 'int64_t' [-Wformat=]
                          en->size, en->pos);
                          ^
libavformat/hlsenc.c:280:26: warning: format '%i' expects argument of type 'int'
, but argument 4 has type 'int64_t' [-Wformat=]

make: *** [libavformat/hlsenc.o] Error 1


编译以下文件:

libavutil\file.c
libavutil\file_open.c
libavutil\log.c
libavutil\random_seed.c
libavutil\time.c
libavformat\cache.c
libavformat\dashenc.c
libavformat\file.c
libavformat\hdsenc.c
libavformat\smoothstreamingenc.c
libavformat\hlsenc.c
libavcodec\libxvid.c
libavcodec\libxvid_rc.c
ffmpeg.c

都有这个错误。其实是没有找到 _EXTERN_C _cdecl __MINGW_NOTHROW ,其在 window.h 中。


解决办法:在以上文件中, #include <unistd.h> 之前加上 #include <windows.h>


0 0