当前位置: 首页 > news >正文

usr/bin/ld链接报错undefined reference `av_frame_free(AVFrame**)‘等ffmpeg库报错

明明在CMakeLists.txt配置了ffmpeg库,还是链接一直报错:

usr/bin/ld: video_processor/libvideo_processor_lib.a(video_processor.cpp.o): in function `VideoProcessor::run()':
video_processor.cpp:(.text+0x17db): undefined reference to `av_frame_free(AVFrame**)'
/usr/bin/ld: video_processor.cpp:(.text+0x1842): undefined reference to `av_frame_free(AVFrame**)'
/usr/bin/ld: video_processor.cpp:(.text+0x1856): undefined reference to `av_frame_free(AVFrame**)'
/usr/bin/ld: ffmpeg_handler/libffmpeg_handler_lib.a(ffmpeg_handler.cpp.o): in function `FFmpegHandler::cleanupReader()':
ffmpeg_handler.cpp:(.text+0x1b5): undefined reference to `avcodec_free_context(AVCodecContext**)'
/usr/bin/ld: ffmpeg_handler.cpp:(.text+0x1d9): undefined reference to `avformat_close_input(AVFormatContext**)'
/usr/bin/ld: ffmpeg_handler.cpp:(.text+0x201): undefined reference to `av_frame_free(AVFrame**)'
/usr/bin/ld: ffmpeg_handler.cpp:(.text+0x22a): undefined reference to `av_packet_free(AVPacket**)'

最可能的原因是库的链接顺序错误,按avformat → avcodec → swscale → avutil的顺序重新配置后,再检查头文件包含和函数调用参数,即可解决链接错误。

ffmpeg.cpp不能配置

extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavcodec/packet.h>
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
#include <libavutil/frame.h> 
#include <libavutil/imgutils.h>
}

只能放在ffmpeg.h中

http://www.dtcms.com/a/314443.html

相关文章:

  • 【Spark征服之路-4.5-Spark-Streaming核心编程(三)】
  • debian 时间同步 设置ntp服务端 客户端
  • FastAPI入门:中间件、CORS跨域资源共享、SQL数据库
  • 【笔记】ROS1|4 Turtlebot3仿真Waffle循线跟踪【旧文转载】
  • Linux 磁盘管理与分区配置
  • open-webui pipelines报404, ‘Filter pipeline.exporter not found‘
  • 【测试工程思考】云平台测试可重用性和场景覆盖度的平衡术
  • 遮天(太古篇)
  • windows内核研究(软件调试-软件断点)
  • [QMT量化交易小白入门]-七十六、从tick数据中获取高频交易的量价背离信号
  • Java开发时出现的问题---语言特性与基础机制陷阱
  • 使用AI IDE编程,如Cursor
  • 小迪安全v2023学习笔记(五十一讲)—— 持续更新中
  • Ubuntu 下编译 SQLCipher 4.8.0
  • yolo实现基于深度学习的龋齿检测系统pyqt
  • Java 发送 HTTP POST请求教程
  • 回归预测 | MATLAB实现BP神经网络多输入单输出回归预测+SHAP可解释分析
  • 基于Matlab的聚类彩色图像分割系统
  • 基于MATLAB实现的心电图自动诊断系统
  • 各种信号分解、模态分解方法合集【MATLAB实现】
  • 链表问题解决分析框架
  • python与C++
  • 【RH124知识点问答题】第7章 控制对文件的访问
  • 【秋招笔试】2025.08.03虾皮秋招笔试-第一题
  • 芯片行业中的EDA(电子设计自动化)是什么?
  • 房屋租赁小程序租房小程序房产信息发布系统房屋租赁微信小程序源码
  • 用户管理——配置文件和命令
  • 探索机器学习在医疗领域的应用与挑战
  • Visual Studio 2022安装与快捷键全攻略
  • AI产品经理面试宝典第61天:AI产品体验、数据安全与架构实战解析