![](/img/trans.png)
[英]Flex and Bison GCC compile error, ld: library not found for -lfl
[英]a gcc strange ld error when compile some ffmpeg application, libvorbisenc package not found
我遵循ffmpeg tuorial ,并通过ppa安装 ffmpeg
但是当我编译tuorial02.c时,出现了gcc错误:
/usr/bin/ld: /opt/ffmpeg/lib//libavcodec.a(libvorbisenc.o): 未定义对符号“vorbis_encode_setup_vbr”的引用
//usr/lib/x86_64-linux-gnu/libvorbisenc.so.2:添加符号时出错:命令行中缺少DSO collect2:错误:ld返回1个退出状态
我的编译命令是:
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
。 错误是找不到 lib。 并且 libvorivisenc2 已经安装。 所以这个问题不是奇怪的链接错误的重复:命令行中缺少 DSO
我的操作系统是 Linux mint 17.3
该错误告诉您静态库libavcodec.a
引用了 libvorbisenc 中的符号,但 libvorbisenc 并未明确出现在您的链接命令中(尽管它确实从链接命令中的另一个共享库中找到了一个很好的候选者)。 您需要在命令行中明确添加-lvorbisenc
或$(pkg-config --libs vorbisenc)
。
(旧版本的 binutils 允许您在这种情况下隐式引入共享库;但是,新版本的 binutils 更严格。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.