FFmpeg报错大全

2021-08-14

g++ ffmpeg_main.cpp -o main -lstdc++ -lavformat -lavutil

报错

/bin/ld: /tmp/ccIemqbh.o: undefined reference to symbol 'avcodec_parameters_copy@@LIBAVCODEC_58'
/usr/local/lib/libavcodec.so: error adding symbols: DSO missing from command line
collect2: 错误:ld 返回 1

原因,动态依赖库的引用是有顺序的,改成这样就ok了。

g++ ffmpeg_main.cpp -o main  -lavformat -lavcodec  -lavutil

-------------------------------------------------------------------------------------------------------------------------------

运行./main的时候,报错,说动态库不存在

 

./main: error while loading shared libraries: libavformat.so: cannot open shared object file: No such file or directory

然后我把动态库放在ffmpeg目录下,然后把目录拷到/lib下面,运行ldconfig, 发现还是不生效。

后来只能按网上试一试:

在ld.so.conf文件中,加入FFmpeg安装lib路径

sudo vi /etc/ld.so.conf

加入:/usr/local/ffmpeg/lib/

完成后执行如下命令

sudo ldconfig

摘自:https://blog.csdn.net/wh8_2011/article/details/69808630

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章