gpt4 book ai didi

c - 编译某些 ffmpeg 应用程序时出现 gcc 奇怪的 ld 错误,找不到 libvorbisenc 包

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:57 25 4
gpt4 key购买 nike

我关注ffmpeg tuorial , 并通过 ppa 安装 ffmpeg

但是当我编译tuorial02.c时,出现gcc错误:

/usr/bin/ld: /opt/ffmpeg/lib//libavcodec.a(libvorbisenc.o): undefined reference to symbol 'vorbis_encode_setup_vbr'

//usr/lib/x86_64-linux-gnu/libvorbisenc.so.2: error adding symbols: DSO missing from command linecollect2: error: ld returned 1 exit status

我的编译命令是:

gcc -I /opt/ffmpeg/include/ -L /opt/ffmpeg/lib/  -o tutorial02 tutorial02.c -lavformat -lavcodec -lswscale `sdl-config --cflags --libs`  -lpthread -lz -lm -ldl

我找了几个小时的原因。我无法解决这个问题。谁能帮帮我?

已添加 我已将 -lvorbisenc 添加到末尾。错误是找不到库。并且 libvorivisenc2 已经安装。所以这个问题不是Strange linking error: DSO missing from command line的重复

我的操作系统是 Linux mint 17.3

最佳答案

错误告诉您静态库 libavcodec.a 引用了 libvorbisenc 中的符号,但 libvorbisenc 并未在您的链接命令中明确显示(尽管它确实从链接命令)。您需要将 -lvorbisenc$(pkg-config --libs vorbisenc) 显式添加到您的命令行。

(旧版本的 binutils 允许您在这种情况下隐式引入共享库;但是,新版本的 binutils 更严格。)

关于c - 编译某些 ffmpeg 应用程序时出现 gcc 奇怪的 ld 错误,找不到 libvorbisenc 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37096129/

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