我按照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:错误添加符号:命令行collect2中缺少DSO:错误: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
我找了几个小时的原因 . 我无法解决这个问题 . 谁能帮我?
Added 我已添加 -lvorbisenc
到最后 . 错误是找不到lib . 和libvorivisenc2已经安装 . 所以这个问题不是Strange linking error: DSO missing from command line的重复
我的操作系统是Linux薄荷17.3
1 回答
该错误告诉您静态库
libavcodec.a
引用libvorbisenc中的符号,但libvorbisenc isn 't explicitly in your link command (though it did find a good candidate from another shared library in the link command). You' ll需要明确地将-lvorbisenc
或$(pkg-config --libs vorbisenc)
添加到您的命令行 .(较旧版本的binutils会让你在这种情况下隐式引入共享库;但是,更新版本的binutils更严格 . )