FFMPEG在link阶段出错

一、错误:

undefined reference to `avformat_close_input(AVFormatContext**)'
undefined reference to `avformat_network_init()'
undefined reference to `av_dict_set(AVDictionary**, char const*, char const*, int)'
undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)'
undefined reference to `av_packet_unref(AVPacket*)'

二、检查 target_link_libraries:

 target_link_libraries(main ascendcl acl_dvpp
         InferBase ascendbasedevice       
         mosquitto protobuf
         crypto chipeaksecure
         opencv_core opencv_highgui opencv_imgcodecs opencv_imgproc opencv_videoio 
         ${FFMPEG_LIBRARIES}                                                                                                                                    
         pthread -Wl,-z,relro,-z,now,-z,noexecstack -pie -s)

三、打印依赖库变量:${FFMPEG_LIBRARIES},发现变量是空的。

152 message("xxxxxxxFFFMPEG ${FFMPEG_LIBRARIES}")                                                                                                                                                                  
153 
154 
155 
156 target_link_libraries(main ascendcl acl_dvpp
157         InferBase ascendbasedevice
158         mosquitto protobuf
159         crypto chipeaksecure
160         opencv_core opencv_highgui opencv_imgcodecs opencv_imgproc opencv_videoio
161         ${FFMPEG_LIBRARIES}
162         #       avcodec avformat avutil swscale pthread m swresample x264
163         pthread -Wl,-z,relro,-z,now,-z,noexecstack -pie -s)

四、检查发现 FFMPEG_PATH 路径出了问题:

 #export FFMPEG_PATH=/opt/data/res/ffmpeg/
 export FFMPEG_PATH=/opt/data/25-manager/res/ffmpeg/ 

五,修正,正常找到了依赖文件:

xxxxxxxFFFMPEG /opt/data/25-manager/res/ffmpeg/lib/libavcodec.so;/opt/data/25-manager/res/ffmpeg/lib/libavdevice.so;/opt/data/25-manager/res/ffmpeg/lib/libavfilter.so;/opt/data/25-manager/res/ffmpeg/lib/libavformat.so;/opt/data/25-manager/res/ffmpeg/lib/libavutil.so;/opt/data/25-manager/res/ffmpeg/lib/libswscale.so;/opt/data/25-manager/res/ffmpeg/lib/libswresample.so

六、link 顺利通过,yeah !!!
七、补充头文件配置:

#ifdef __cplusplus
extern "C" {
#endif
#include "libavformat/avformat.h"
#ifdef __cplusplus
}
#endif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值