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>
}
相关推荐
动力 continue4 小时前
Linux 基础篇 · 压缩打包与用户管理
linux·服务器·基础命令linux
画中有画5 小时前
软件架构中质量属性(性能、安全、可扩展性)的权衡设计
java·运维·安全
NJCloud5 小时前
Ansible(三)——Zabbix 监控系统部署与敏感信息加密
linux·运维·chrome·信息可视化·ansible·zabbix
ltl6 小时前
Cgroups v2:为什么内存限制设了,宿主机数据库还是被 OOM
linux
NJCloud6 小时前
TiDB 集群部署与 MySQL 兼容性适配实战
linux·运维·数据库·mysql·tidb
2401_868534786 小时前
UNIX常用命令英文全称与中文解释整理
linux·运维
阿祖zu7 小时前
开源项目-让本地 Codex 临时接管远程 Linux 服务,实现快速运维
linux·gpt·agent
Android系统攻城狮9 小时前
Linux PipeWire深度解析之pw_factory_create_object调用流程与实战(七十二)
linux·音频进阶·pipewire音频进阶
lsh曙光9 小时前
playbook剧本(2)--Ansible变量
linux·运维·网络
lengjingzju9 小时前
编译与调试完全指南—第14章 系统配置与调优
linux