【FFMPEG】【ARM-Linux开发】 ffmpeg 静态库使用,undefined reference错误
原文:http://blog.csdn.net/chinazjn/article/details/7954984
ffmpeg移植到dm365上,遇到undefined reference錯(cuò)誤:
GA/gabin/lib/libavformat.a(allformats.o): In function `av_register_all':
/GA/ffmpeg-0.10/libavformat/allformats.c:53: undefined reference to `avcodec_register_all'
/GA/gabin/lib/libavformat.a(amr.o): In function `amr_read_packet':
/GA/ffmpeg-0.10/libavformat/amr.c:153: undefined reference to `av_new_packet'
/GA/ffmpeg-0.10/libavformat/amr.c:169: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(anm.o): In function `read_header':
/GA/ffmpeg-0.10/libavformat/anm.c:89: undefined reference to `av_log_ask_for_sample'
/GA/ffmpeg-0.10/libavformat/anm.c:166: undefined reference to `av_log_ask_for_sample'
/GA/gabin/lib/libavformat.a(ape.o): In function `ape_read_packet':
/GA/ffmpeg-0.10/libavformat/ape.c:372: undefined reference to `av_new_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `free_variant_list':
/GA/ffmpeg-0.10/libavformat/applehttp.c:131: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/ffmpeg-0.10/libavformat/applehttp.c:151: undefined reference to `av_init_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `applehttp_read_seek':
/GA/ffmpeg-0.10/libavformat/applehttp.c:712: undefined reference to `av_free_packet'
/GA/gabin/lib/libavformat.a(applehttp.o): In function `reset_packet':
網(wǎng)上查閱,普遍提示兩種解決方法:
一、ffmpeg是純C的庫(kù),應(yīng)用程序用C++來(lái)編譯。
二、路徑、需要的庫(kù)包含不全。
以上具體就不說(shuō)了,搜索下便是。
我在無(wú)數(shù)遍仔細(xì)確認(rèn)上述兩種可能性后,仍然報(bào)錯(cuò)。郁悶了一個(gè)晚上。。
后來(lái)查閱ffmpeg的 pkg-config,終于找到原因,錯(cuò)誤導(dǎo)致過(guò)程讓我痛苦,原因卻很簡(jiǎn)單。
錯(cuò)誤:gcc? test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib??-lavcodec -lavformat? -lavdevice?-lavutil -pthread? -ldl -lswscale -lSDL -lbz2? -lasound -lz -lm ?
調(diào)整: gcc? test.c -o test -I/GA/gabin/include/ -L/GA/gabin/lib??-lavformat? -lavdevice?-lavcodec??-lavutil -pthread? -ldl -lswscale -lSDL -lbz2? -lasound -lz -lm??
問(wèn)題解決,同志需要注意包依賴關(guān)系。
轉(zhuǎn)載于:https://www.cnblogs.com/huty/p/8517568.html
總結(jié)
以上是生活随笔為你收集整理的【FFMPEG】【ARM-Linux开发】 ffmpeg 静态库使用,undefined reference错误的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 十六周个人作业
- 下一篇: 使用密钥登录CentOS系统(基于密钥的