CMake undefined reference to 问题

Simples/app/src/main/cpp/../../../../ffmpeg-3.3.3/build/android/arm64-v8a/lib/libavcodec.a(utils.o): In function `avcodec_string':
Simples/ffmpeg-3.3.3/ libavcodec/utils.c:3239: undefined reference to ` av_get_media_type_string
Simples/ffmpeg-3.3.3/libavcodec/utils.c:3260: undefined reference to `av_fourcc_make_string'
Simples/app/src/main/cpp/../../../../ffmpeg-3.3.3/build/android/arm64-v8a/lib/libavformat.a(apngenc.o): In function `apng_write_chunk':
Simples/ffmpeg-3.3.3/libavformat/apngenc.c:64: undefined reference to `av_crc_get_table'
Simples/ffmpeg-3.3.3/libavformat/apngenc.c:72: undefined reference to `av_crc'
Simples/ffmpeg-3.3.3/libavformat/apngenc.c:75: undefined reference to `av_crc'
Simples/app/src/main/cpp/../../../../ffmpeg-3.3.3/build/android/arm64-v8a/lib/libavformat.a(apngenc.o): In function `flush_packet':
Simples/ffmpeg-3.3.3/libavformat/apngenc.c:209: undefined reference to `av_crc_get_table'
Simples/ffmpeg-3.3.3/libavformat/apngenc.c:209: undefined reference to `av_crc'

出现该问题很可能是target_link_librarie()中依赖库的顺序不对,需要调整target_link_librarie() 中依赖库的顺序。
比如这里 `av_get_media_type_string’ avutil中一个函数,所以,可以看出   libavcodec 是 依赖 lib avutil的 ,则 avcodec 必须写在avutil 的前面。
切记:是  avcodec  写在 avutil  的前面,而不是后面。
target_link_libraries( # Specifies the target library.
                       ffmpeg-lib

                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib}
                       ${android-lib}
                       swscale
                       avformat
                       avcodec
                       swresample
                       avutil
                       avfilter
                       ${z-lib}
                       ${m-lib}
                       ) 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

songtao542

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值