【FFMPEG】【ARM-Linux开发】 ffmpeg 静态库使用,undefined reference错误
原文:http://blog.csdn.net/chinazjn/article/details/7954984
ffmpeg移植到dm365上,遇到undefined reference錯誤:
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':
網上查閱,普遍提示兩種解決方法:
一、ffmpeg是純C的庫,應用程序用C++來編譯。
二、路徑、需要的庫包含不全。
以上具體就不說了,搜索下便是。
我在無數遍仔細確認上述兩種可能性后,仍然報錯。郁悶了一個晚上。。
后來查閱ffmpeg的 pkg-config,終于找到原因,錯誤導致過程讓我痛苦,原因卻很簡單。
錯誤: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 ?
調整: 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??
問題解決,同志需要注意包依賴關系。
轉載于:https://www.cnblogs.com/huty/p/8517568.html
總結
以上是生活随笔為你收集整理的【FFMPEG】【ARM-Linux开发】 ffmpeg 静态库使用,undefined reference错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 十六周个人作业
- 下一篇: Linux install innot