: undefined reference to `av_log' ffmpeg 编译例程出错 解决方法
来源:互联网 发布:安广网络电视怎么缴费 编辑:程序博客网 时间:2024/05/19 12:11
出错状况:
使用SVN 获取ffmpeg
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
安装成功。
编译简单例程:
#include <libavcodec/avcodec.h>#include <libavformat/avformat.h>#include <stdio.h>int main(int argc,char*argv[]){av_register_all();return 0;}
使用:gcc examp.c -lavcodec -lavformat -lavdevice -lavutil 编译。
报N错。
/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:770: undefined reference to `av_buffer_alloc'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `ff_thread_get_format':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:822: undefined reference to `av_log'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `ff_thread_await_progress':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:502: undefined reference to `av_log'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `release_delayed_buffers':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:302: undefined reference to `av_frame_unref'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `submit_packet':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:336: undefined reference to `av_buffer_unref'/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:339: undefined reference to `av_buffer_ref'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `ff_thread_decode_frame':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:449: undefined reference to `av_frame_move_ref'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `update_context_from_user':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:271: undefined reference to `av_realloc'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `submit_packet':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:341: undefined reference to `av_fast_malloc'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `update_context_from_user':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:274: undefined reference to `av_free'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `submit_packet':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:298: undefined reference to `av_log'/usr/local/lib/libavcodec.a(pthread_frame.o): In function `release_delayed_buffers':/home/lnstree/ffmpegSrc/ffmpeg/libavcodec/pthread_frame.c:302: undefined reference to `av_frame_unref'。。。。。
解决方法:
将make install 安装的 libavxxx.pc 文件移到默认pkg-config 目录中。
本机make install libavxxxx.pc 文件 在/usr/local/lib/pkgconfig
使用命令 cp /usr/local/lib/pkgconfig/* /usr/share/pkgconfig/ 拷贝。
注:ffmpeg 源码 附带 例程。 make install 后 例程 在/usr/local/share/ffmpeg/examples 下。 里面有Makefile 文件。
在该目录下 make。(前提 所有 libavxxx.pc 已经移入默认目录/usr/share/pkconfig/)
make :
cc decoding_encoding.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -lm -o decoding_encodingcc demuxing_decoding.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o demuxing_decodingcc filtering_video.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o filtering_videocc filtering_audio.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o filtering_audiocc metadata.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o metadatacc muxing.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -lm -o muxingcc resampling_audio.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -lm -o resampling_audiocc scaling_video.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o scaling_videocc transcode_aac.o -pthread -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm -o transcode_aac
然后 使用 该make 显示的编译参数
gcc example.c -lavdevice -lavfilter -lavformat -lavcodec -ldl -lX11 -lasound -lSDL -lpthread -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lfaac -lz -lrt -lswresample -lswscale -lavutil -lm
; D 偷懒,一大堆依赖看不懂,能用就行。
成功!!
参考网址:
http://blog.csdn.net/ajaxhe/article/details/9499815 有关pkg-config
http://www.myexception.cn/program/718423.html
0 0
- : undefined reference to `av_log' ffmpeg 编译例程出错 解决方法
- FFmpeg编译出错undefined reference to `img_convert’的解决方法
- FFmpeg编译出错undefined reference to `img_convert’的解决方法
- FFmpeg编译出错undefined reference to `img_convert’的解决方法
- FFmpeg编译出错undefined reference to `img_convert’的解决方法
- 编译出错 "undefined reference to"
- 编译出错 "undefined reference to" .
- 编译ffmpeg例程时,报错:undefined reference
- ffmpeg libx264编译出现error: undefined reference to 'x264_picture_init'等问题的解决方法
- 使用ffmpeg库编译错误undefined reference to `BZ2_bzDecompressInit'
- 使用ffmpeg库编译错误undefined reference to `BZ2_bzDecompressInit'
- 使用ffmpeg库编译错误undefined reference to `BZ2_bzDecompressInit'
- SDK编译数学函数出错:"undefined reference to 'cos/sin'
- 线程程序编译出错 undefined reference to `pthread_create'
- undefined reference to 'socket@12'编译socket出错codeblocks
- mingw编译x264 出错undefined reference to `__sync_add_and_fetch_4
- qt+mingw编译出错,提示undefined reference to `**@**'
- 编译静态expect现undefined reference to `openpty' 错误解决方法
- 几个最短路径算法Floyd、Dijkstra、Bellman-Ford、SPFA的比较
- 一个互联网用户的对生活的感悟
- mongodb 备份
- 难过了,不要告诉别人。。因为真的没人会真正的在乎。。。
- Remove Duplicates from Sorted Array
- : undefined reference to `av_log' ffmpeg 编译例程出错 解决方法
- mysql的一些简单语句
- pongo(英雄会)题解之均分01
- (转)LR 中线程进程问题,持续更新。。。
- 永远不要向任何人解释你自己
- cygwin的mintty窗口中输出的中文是乱码
- bindServer的作用
- hibernate集合映射inverse和cascade详解
- Hibernate批处理操作优化 (批量插入、更新与删除)