gpt4 book ai didi

linux - 无法将应用程序与 libavcodec 链接

转载 作者:行者123 更新时间:2023-12-04 23:12:58 31 4
gpt4 key购买 nike

我正在尝试使用 ffmpeg 库制作一个最简单的应用程序。
这是我的代码:

主.c:

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>

int main()
{

avformat_network_init();
return 0;
}


编译器命令:
gcc -o main main.c -Wall  -lavformat -lavcodec -lswresample -lswscale -lavutil -lm -lz -lpthread -L/usr/local/lib/

导致 :

/usr/local/lib//libavformat.a(matroskaenc.o): In function get_aac_sample_rates':
/home/ievdokimov/repos/FFmpeg/libavformat/matroskaenc.c:709: undefined
reference to
avpriv_mpeg4audio_get_config2' /home/ievdokimov/repos/FFmpeg/libavformat/matroskaenc.c:709: undefined reference to avpriv_mpeg4audio_get_config2'
/usr/local/lib//libavformat.a(mux.o): In function
ff_interleave_add_packet': /home/ievdokimov/repos/FFmpeg/libavformat/mux.c:936: undefined reference to av_packet_make_refcounted'
/usr/local/lib//libavformat.a(utils.o): In function
ff_packet_list_put': /home/ievdokimov/repos/FFmpeg/libavformat/utils.c:461: undefined reference to av_packet_make_refcounted'
/usr/local/lib//libavformat.a(utils.o): In function
parse_packet': /home/ievdokimov/repos/FFmpeg/libavformat/utils.c:1494: undefined reference to av_packet_make_refcounted'
/usr/local/lib//libavformat.a(utils.o): In function
ff_read_packet': /home/ievdokimov/repos/FFmpeg/libavformat/utils.c:876: undefined reference to av_packet_make_refcounted'
/usr/local/lib//libavformat.a(codec2.o): In function
codec2_read_header_common': /home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:74: undefined reference to avpriv_codec2_mode_bit_rate'
/home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:75: undefined
reference to
avpriv_codec2_mode_frame_size' /home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:76: undefined reference to avpriv_codec2_mode_block_align'
/home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:74: undefined
reference to
avpriv_codec2_mode_bit_rate' /home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:75: undefined reference to avpriv_codec2_mode_frame_size'
/home/ievdokimov/repos/FFmpeg/libavformat/codec2.c:76: undefined
reference to
avpriv_codec2_mode_block_align' /usr/local/lib//libavformat.a(isom.o): In function ff_mp4_read_dec_config_descr':
/home/ievdokimov/repos/FFmpeg/libavformat/isom.c:552: undefined
reference to
avpriv_mpeg4audio_get_config2' /usr/local/lib//libavformat.a(latmenc.o): In function latm_decode_extradata':
/home/ievdokimov/repos/FFmpeg/libavformat/latmenc.c:65: undefined
reference to
avpriv_mpeg4audio_get_config2' /home/ievdokimov/repos/FFmpeg/libavformat/latmenc.c:65: undefined reference to avpriv_mpeg4audio_get_config2'
/usr/local/lib//libavformat.a(matroskadec.o): In function
matroska_decode_buffer': /home/ievdokimov/repos/FFmpeg/libavformat/matroskadec.c:1657: undefined reference to BZ2_bzDecompressInit'
/home/ievdokimov/repos/FFmpeg/libavformat/matroskadec.c:1672:
undefined reference to
BZ2_bzDecompress' /home/ievdokimov/repos/FFmpeg/libavformat/matroskadec.c:1665: undefined reference to BZ2_bzDecompressEnd'
/home/ievdokimov/repos/FFmpeg/libavformat/matroskadec.c:1675:
undefined reference to
BZ2_bzDecompressEnd' /usr/local/lib//libavformat.a(mxfenc.o): In function get_ue_golomb_31':
/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:140: undefined
reference to
ff_ue_golomb_vlc_code' /usr/local/lib//libavformat.a(mxfenc.o): In function mxf_parse_dnxhd_frame':
/home/ievdokimov/repos/FFmpeg/libavformat/mxfenc.c:2030: undefined
reference to
avpriv_dnxhd_get_hr_frame_size' /usr/local/lib//libavformat.a(rtpenc_vc2hq.o): In function init_get_bits_xe':
/home/ievdokimov/repos/FFmpeg/./libavcodec/get_bits.h:628: undefined
reference to
ff_interleaved_golomb_vlc_len' /usr/local/lib//libavformat.a(rtpenc_vc2hq.o): In function get_interleaved_ue_golomb':
/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:197: undefined
reference to
ff_interleaved_dirac_golomb_vlc_code' /home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:185: undefined reference to ff_interleaved_dirac_golomb_vlc_code'
/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:197: undefined
reference to
ff_interleaved_dirac_golomb_vlc_code' /home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:197: undefined reference to ff_interleaved_dirac_golomb_vlc_code'
/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:185: undefined
reference to
ff_interleaved_dirac_golomb_vlc_code' /usr/local/lib//libavformat.a(rtpenc_vc2hq.o):/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:185: more undefined references to ff_interleaved_dirac_golomb_vlc_code'
follow /usr/local/lib//libavformat.a(rtpenc_vc2hq.o): In function
get_interleaved_ue_golomb': /home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:183: undefined reference to ff_interleaved_ue_golomb_vlc_code'
/home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:183: undefined
reference to
ff_interleaved_ue_golomb_vlc_code' /home/ievdokimov/repos/FFmpeg/./libavcodec/golomb.h:183: undefined reference to ff_interleaved_ue_golomb_vlc_code'
/usr/local/lib//libavformat.a(spdifdec.o): In function
spdif_get_offset_and_codec': /home/ievdokimov/repos/FFmpeg/libavformat/spdifdec.c:63: undefined reference to av_adts_header_parse'
/home/ievdokimov/repos/FFmpeg/libavformat/spdifdec.c:63: undefined
reference to
av_adts_header_parse' /usr/local/lib//libavformat.a(spdifenc.o): In function spdif_header_aac':
/home/ievdokimov/repos/FFmpeg/libavformat/spdifenc.c:362: undefined
reference to
av_adts_header_parse' /usr/local/lib//libavformat.a(ac3dec.o): In function ac3_eac3_probe':
/home/ievdokimov/repos/FFmpeg/libavformat/ac3dec.c:63: undefined
reference to
av_ac3_parse_header' /home/ievdokimov/repos/FFmpeg/libavformat/ac3dec.c:60: undefined reference to av_ac3_parse_header'
/usr/local/lib//libavformat.a(adtsenc.o): In function
adts_decode_extradata': /home/ievdokimov/repos/FFmpeg/libavformat/adtsenc.c:56: undefined reference to `avpriv_mpeg4audio_get_config2' collect2: error: ld returned 1 exit status



有没有办法解决这个问题?

最佳答案

好像是 libavformat.so文件版本与其他库不同。
请检查与其他库兼容的版本,如 liavcodec

关于linux - 无法将应用程序与 libavcodec 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60850419/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com