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>
}
相关推荐
Cyber4K5 分钟前
【Kubernetes专项】DockerFile、数据持计划、网络模式及资源配额
运维·网络·云原生·容器·kubernetes
学好statistics和DS6 分钟前
命令替换(Command Substitution)详解
linux
zimoyin6 分钟前
浅浅了解下0拷贝技术
java·linux·开发语言
ba_pi21 分钟前
每天写点什么2026-01-09-linux基础
linux·运维·服务器
少云清32 分钟前
【性能测试】3_性能测试基础 _指标
运维·服务器·数据库·性能测试·性能测试指标
广州服务器托管36 分钟前
比较优秀的视频音频播放器PotPlayer64-v1.7.22764绿色版
运维·windows·计算机网络·电脑·音视频·可信计算技术
wdfk_prog1 小时前
[Linux]学习笔记系列 -- 底层CPU与体系结构宏
linux·笔记·学习
行走的bug...1 小时前
cmake总结
linux·运维·服务器
zfxwasaboy1 小时前
DRM KMS 子系统(3)CRTC
linux·c语言
凌波粒1 小时前
Linux 面试题篇
linux·运维·服务器