我最近一直在尝试编译使用 FFmpeg 库的 C 代码;但是,由于我无法确定的原因,编译失败。
我一直在尝试编译的代码是 Doxygen 文档网站上 FFmpeg 上的 filtering_audio.c 文件(我将提供链接,因为代码太长,无法在此处引用): http: //ffmpeg.org/ doxygen/trunk/doc_2examples_2filtering_audio_8c-example.html
我使用 gcc 编译代码:
gcc filter.c -lavformat -lavcodec -lavfilter -lavutil
我得到以下未定义的参考错误:
/tmp/cc90K2S5.o: In function `init_filters':
filter.c:(.text+0x3e5): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x407): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x42d): undefined reference to `av_opt_set_bin'
filter.c:(.text+0x482): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x4a4): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x4ca): undefined reference to `av_opt_set_bin'
filter.c:(.text+0x51f): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x541): undefined reference to `av_int_list_length_for_size'
filter.c:(.text+0x567): undefined reference to `av_opt_set_bin'
/tmp/cc90K2S5.o: In function `print_frame':
filter.c:(.text+0x76b): undefined reference to `av_frame_get_channel_layout'
/tmp/cc90K2S5.o: In function `main':
filter.c:(.text+0x831): undefined reference to `av_frame_alloc'
filter.c:(.text+0x83d): undefined reference to `av_frame_alloc'
filter.c:(.text+0x9de): undefined reference to `av_buffersrc_add_frame_flags'
filter.c:(.text+0xa16): undefined reference to `av_buffersink_get_frame'
filter.c:(.text+0xa58): undefined reference to `av_frame_unref'
filter.c:(.text+0xab6): undefined reference to `av_frame_free'
filter.c:(.text+0xac5): undefined reference to `av_frame_free'
collect2: error: ld returned 1 exit status
我知道未定义的引用错误表明它无法找到从 filtering_audio.c 引用的函数,但这没有意义,因为这些函数应该存在于 FFmpeg 库中。
任何帮助表示赞赏,谢谢!