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

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>


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值