ubuntu编译遇到的问题

一.ffmpeg链接不到库文件

cpp 复制代码
undefined reference to `avcodec_register_all'
undefined reference to `avcodec_register_all'
undefined reference to `av_opt_set_defaults'
undefined reference to `av_opt_set_defaults'
undefined reference to `av_parse_video_frame_rate'
undefined reference to `av_parse_video_frame_size'
undefined reference to `avcodec_string'
undefined reference to `avcodec_alloc_context'
undefined reference to `av_fast_realloc'
undefined reference to `av_get_bits_per_sample'
undefined reference to `av_parser_close'
undefined reference to `av_parser_close'

问题分析:函数实现在.c文件中,需要将相关的头文件使用extern "C" { }包含起来。

cpp 复制代码
extern "C"
{
#include <libavutil/frame.h>
#include <libavutil/mem.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
相关推荐
kuroomi3 小时前
Docker 与容器基础
linux·运维·docker
_itgo9 小时前
意图识别落地方案
运维·docker·容器
fangjianj9 小时前
LAMP 项目部署
linux
mengge.cloud9 小时前
0909华为云计算类综合服务小白实验教程
linux·运维·服务器·网络·华为云·云计算
fangjianj10 小时前
自有服务及软件包
linux
QYR-分析11 小时前
蓝海赛道高速扩容!全球小型观察ROV市场格局、细分场景与发展趋势分析
大数据·运维·云计算
陈皮糖..11 小时前
从零搭建一个简易 AI 运维问答机器人(RAG + LangChain + Streamlit)
运维·人工智能·ai·langchain·机器人
风哥2号12 小时前
数据库教程FGMT03‑生产环境Linux+Oracle19c+ASM安装配置与项目实战
linux·数据库
一木 之林12 小时前
七、一-AI 工程实践、插件化调试与软件交付
java·linux·c++
制造业的搬运工12 小时前
AI服务器背板与传统背板差异:三大设计升级解析
运维·服务器·人工智能·科技·制造·pcb工艺