ffmpeg 静态库使用,undefined reference错误

本文记录了在编译FFmpeg过程中遇到的未定义引用错误及警告信息,并给出了正确的库文件包含顺序,最终解决了编译问题。
home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(os_support.o): In function `resolve_host':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/os_support.c:69: warning: gethostbyname is obsolescent, use getnameinfo() instead.
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(allformats.o): In function `av_register_all':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/allformats.c:47: undefined reference to `avcodec_register_all'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(utils.o): In function `av_find_stream_info':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/utils.c:2178: undefined reference to `avcodec_pix_fmt_to_codec_tag'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(aiff.o): In function `aiff_write_header':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/aiff.c:228: undefined reference to `av_dbl2ext'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(aiff.o): In function `get_aiff_header':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/aiff.c:115: undefined reference to `av_ext2dbl'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(asfcrypt.o): In function `ff_asfcrypt_dec':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:155: undefined reference to `av_rc4_init'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:156: undefined reference to `av_rc4_crypt'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:161: undefined reference to `av_des_init'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:162: undefined reference to `av_des_crypt'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:165: undefined reference to `av_rc4_init'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/asfcrypt.c:166: undefined reference to `av_rc4_crypt'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(swfenc.o): In function `swf_write_trailer':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:484: undefined reference to `av_fifo_free'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(swfenc.o): In function `swf_write_video':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:417: undefined reference to `av_fifo_size'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:418: undefined reference to `av_fifo_size'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:422: undefined reference to `av_fifo_generic_read'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(swfenc.o): In function `swf_write_audio':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:447: undefined reference to `av_fifo_size'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:452: undefined reference to `av_fifo_generic_write'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(swfenc.o): In function `swf_write_header':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/swfenc.c:195: undefined reference to `av_fifo_init'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(crcenc.o): In function `crc_write_packet':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/crcenc.c:42: undefined reference to `av_adler32_update'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(dvenc.o): In function `dv_delete_mux':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/dvenc.c:359: undefined reference to `av_fifo_free'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(dvenc.o): In function `dv_init_mux':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/dvenc.c:340: undefined reference to `av_fifo_init'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/dvenc.c:343: undefined reference to `av_fifo_free'
/home/3521dWork/3521dCode/hisiApp/ffmpeg/hisi_lib/libavformat.a(dvenc.o): In function `dv_assemble_frame':
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/dvenc.c:254: undefined reference to `av_fifo_size'
/home/3521dWork/ffmpeg/ffmpeg-0.5/libavformat/dvenc.c:256: undefined reference to `av_fifo_generic_write'


.......

猜测是由于包含库的顺序原因,具体ffmpeg包含顺序是啥,百度后尝试下,编译通过,我的具体顺序而下:

LIBS += /home/ffmpeg/hisi_lib/libavformat.a
LIBS += /home/ffmpeg/hisi_lib/libavdevice.a
LIBS += /home/ffmpeg/hisi_lib/libavcodec.a
LIBS += /home/ffmpeg/hisi_lib/libavutil.a
LIBS += /home/ffmpeg/hisi_lib/libswscale.a
LIBS += /home/ffmpeg/hisi_lib/libavfilter.a

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值