ffmpeg 静态库使用,undefined reference错误
2017-08-15 10:18
134 查看
form: 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
问题解决,同志需要注意包依赖关系。
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
问题解决,同志需要注意包依赖关系。
相关文章推荐
- ffmpeg 静态库使用,undefined reference错误
- ffmpeg 静态库使用,undefined reference错误
- 使用opencv 2.2静态库时: undefined reference to `clock_gettime' 链接错误问题解决
- 使用g++编译C/C++程序,链接时出现undefined reference to错误
- 编译 FFmpeg h263 decoder出现编译错误undefined reference to `ff_find_pix_fmt'
- Ubuntu下使用Eclipse编译pthread程序错误undefined reference to `pthread_create'
- C++中Boost使用出现错误undefined reference to `boost::system::generic_category()'解决方法
- QT 使用串口类出现“undefined reference to QSerialPort::QSerialPort(QObject*)错误
- Qt+ffmpeg 配置 错误:undefined reference to `av_get_random_seed' 找不到.so
- ubuntu上在使用c/c++连接mysql时,出现undefined reference错误解决办法
- Libcurl使用OpenSSL编译出现undefined reference to `COMP_CTX_free'错误备忘
- 使用so动态链接库g++正确,gcc undefined reference错误
- 使用c语言风格的文件读写fopen,在build gcce时会出现undefined reference错误
- 使用Sqlite出现undefined reference to `sqlite3_open'错误的解决
- jni中出现使用LOGD,出现undefined reference to '__android_log_print错误
- Qt错误:类中使用Q_OBJECT宏导致undefined reference to vtable for "xxx::xxx"错误的原因和解决方法
- 编译静态expect现undefined reference to `openpty' 错误解决方法
- 使用muduo编译链接错误 undefined reference to `muduo::ThreadPool::run(boost::function<void ()()>&&)'
- cocos2d-x 使用ndk编译 x86 出现 in function Curl_resolv_timeout: undefined reference to 'sigsetjmp' 错误
- Qt的“undefined reference to `vtable for”错误解决(手动解决,加深理解)