gpt4 book ai didi

c - ffmpeg 与 CodeBlocks 的链接错误

转载 作者:行者123 更新时间:2023-11-30 17:18:39 25 4
gpt4 key购买 nike

嗨,我目前正在使用ffmpeg做一个实时视频编码c程序,最初我遇到了很多“ undefined reference ”错误,在我在构建选项中设置链接器后,一些错误消失了,但仍然存在一些错误.

||=== Build: Debug in c_3rd party encoding (compiler: GNU GCC Compiler)     ===|
/home/yonghao/codeblocksfile/c_3rd party encoding/main.c||In function ‘init_video_encode’:|
/home/yonghao/codeblocksfile/c_3rd party encoding/main.c|73|warning: ‘avcodec_alloc_frame’ is deprecated (declared at ../../ffmpeg_build/include/libavcodec/avcodec.h:3618) [-Wdeprecated-declarations]|
/home/yonghao/codeblocksfile/c_3rd party encoding/main.c||In function ‘cancle_encode’:|
/home/yonghao/codeblocksfile/c_3rd party encoding/main.c|134|warning: ‘avcodec_free_frame’ is deprecated (declared at ../../ffmpeg_build/include/libavcodec/avcodec.h:3643) [-Wdeprecated-declarations]|
/home/yonghao/codeblocksfile/c_3rd party encoding/main.c|21|warning: ‘endcode’ defined but not used [-Wunused-variable]|
../../ffmpeg_build/lib/libavcodec.a(libmp3lame.o)||In function `mp3lame_encode_frame':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|211|undefined reference to `lame_encode_buffer_float'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|195|undefined reference to `lame_encode_buffer'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|198|undefined reference to `lame_encode_buffer_int'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|219|undefined reference to `lame_encode_flush'|
../../ffmpeg_build/lib/libavcodec.a(libmp3lame.o)||In function `mp3lame_encode_close':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|86|undefined reference to `lame_close'|
../../ffmpeg_build/lib/libavcodec.a(libmp3lame.o)||In function `mp3lame_encode_init':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|98|undefined reference to `lame_init'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|102|undefined reference to `lame_set_num_channels'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|103|undefined reference to `lame_set_mode'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|106|undefined reference to `lame_set_in_samplerate'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|107|undefined reference to `lame_set_out_samplerate'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|111|undefined reference to `lame_set_quality'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|115|undefined reference to `lame_set_VBR'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|116|undefined reference to `lame_set_VBR_quality'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|120|undefined reference to `lame_set_VBR'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|121|undefined reference to `lame_set_VBR_mean_bitrate_kbps'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|123|undefined reference to `lame_set_brate'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|128|undefined reference to `lame_set_bWriteVbrTag'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|131|undefined reference to `lame_set_disable_reservoir'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|134|undefined reference to `lame_init_params'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|140|undefined reference to `lame_get_encoder_delay'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libmp3lame.c|143|undefined reference to `lame_get_framesize'|
../../ffmpeg_build/lib/libavcodec.a(libopusdec.o)||In function `libopus_flush':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|178|undefined reference to `opus_multistream_decoder_ctl'|
../../ffmpeg_build/lib/libavcodec.a(libopusdec.o)||In function `libopus_decode':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|143|undefined reference to `opus_multistream_decode_float'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|139|undefined reference to `opus_multistream_decode'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|148|undefined reference to `opus_strerror'|
../../ffmpeg_build/lib/libavcodec.a(libopusdec.o)||In function `libopus_decode_close':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|121|undefined reference to `opus_multistream_decoder_destroy'|
../../ffmpeg_build/lib/libavcodec.a(libopusdec.o)||In function `libopus_decode_init':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|87|undefined reference to `opus_multistream_decoder_create'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|91|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|97|undefined reference to `opus_multistream_decoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c|99|undefined reference to `opus_strerror'|
../../ffmpeg_build/lib/libavcodec.a(libopusenc.o)||In function `libopus_encode':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|346|undefined reference to `opus_multistream_encode'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|342|undefined reference to `opus_multistream_encode_float'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|351|undefined reference to `opus_strerror'|
../../ffmpeg_build/lib/libavcodec.a(libopusenc.o)||In function `libopus_encode_close':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|389|undefined reference to `opus_multistream_encoder_destroy'|
../../ffmpeg_build/lib/libavcodec.a(libopusenc.o)||In function `libopus_encode_init':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|254|undefined reference to `opus_multistream_encoder_create'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|260|undefined reference to `opus_strerror'|
../../ffmpeg_build/lib/libavcodec.a(libopusenc.o)||In function `libopus_configure_encoder':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|117|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|119|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|124|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|127|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|130|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|132|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|135|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|138|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|141|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|144|undefined reference to `opus_strerror'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|149|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|152|undefined reference to `opus_strerror'|
../../ffmpeg_build/lib/libavcodec.a(libopusenc.o)||In function `libopus_encode_init':|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|288|undefined reference to `opus_multistream_encoder_ctl'|
/home/yonghao/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c|290|undefined reference to `opus_strerror'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 3 warning(s) (0 minute(s), 3 second(s)) ===|

这是我的 CodeBlock 链接器设置的屏幕截图。

ffmpeg_build/lib/libvpx.a
ffmpeg_build/lib/libswscale.a
ffmpeg_build/lib/libwresample.a
ffmpeg_build/lib/libpostproc.a
ffmpeg_build/lib/libfdk-aac.a
ffmpeg_build/lib/libvutil.a
ffmpeg_build/lib/libvformat.a
ffmpeg_build/lib/libavfilter.a
ffmpeg_build/lib/libavdevice.a
ffmpeg_build/lib/libavcodec.a

总共 10 个库。

我的问题:

  1. 这些错误是由于缺少库或未链接库引起的吗?
  2. 我缺少哪些库或者我应该向链接器添加哪些库。

最佳答案

链接顺序似乎不匹配。要了解链接顺序,请参阅 Why does the order in which libraries are linked sometimes cause errors in GCC?

尝试以下链接顺序

libavdevice
libavformat
libavfilter
libavcodec
libwscale
libavutil
libswresample
libswscale
libpostproc
libavresample

关于c - ffmpeg 与 CodeBlocks 的链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29119525/

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