【发布时间】:2015-11-07 07:59:51
【问题描述】:
我正在尝试从 libav 文档编译本教程:link
我没有改变代码!
但是当我编译它时:
gcc test.c -lavformat -lswscale -lavdevice -lavformat -lavcodec -lavutil -lpthread -lm -o example
我收到以下错误:
undefined reference to `check_sample_fmt'
undefined reference to `select_sample_rate'
undefined reference to `select_channel_layout'
undefined reference to `av_frame_alloc'
undefined reference to `av_frame_free'
搜索 Dr.google 我读到它可能与库的链接顺序有关。但是我还没有找到正确的?!
编辑: 这个“可能重复”似乎与我的问题无关
【问题讨论】:
-
谢谢Dayal,我已经看过那个话题了!但不要认为这与我的问题有关
-
我也试过这个命令: gcc -o example test.c -lavformat -lavcodec -lavutil -lswscale -lfdk-aac -lao -lavdevice -lavresample -lpthread -lm 现在我只有 undefined参考“av_frame_alloc 和 av_frame_free”
-
您确定需要链接所有这些库吗?该示例程序仅使用
gcc test.c -lavutil -lm -lavcodec -o example对我来说编译得很好 -
谢谢@szx,遗憾的是我仍然得到一些未定义的参考错误。也许这会有所帮助。我正在使用带有 ./configure --disable-shared --enable-static 的 libav(11.4) 我从 doc 文件夹中的示例中复制了“音频解码”的示例代码。这是我发布的示例的较新版本(我只能在网上找到这个旧版本)
标签: c ffmpeg libavcodec libav libavformat