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>
}
相关推荐
love530love1 小时前
【笔记】在 MSYS2(MINGW64)中安装 python-maturin 的记录
运维·开发语言·人工智能·windows·笔记·python
yan123683 小时前
Linux 驱动之设备树
android·linux·驱动开发·linux驱动
吐泡泡_3 小时前
进程间通信(消息队列)
linux
Li-Yongjun5 小时前
5G-A:开启通信与行业变革的新时代
运维·服务器·5g
待什么青丝5 小时前
【Ubuntu】摸鱼技巧之虚拟机环境复制
linux·运维·ubuntu
Demisse5 小时前
[MongoDB] 认识MongoDB以及在Windows和Linux上安装MongoDB
linux·windows·mongodb
中杯可乐多加冰5 小时前
采用Bright Data+n8n+AI打造自动化新闻助手:每天5分钟实现内容日更
运维·人工智能·自动化·大模型·aigc·n8n
东临碣石826 小时前
【AI论文】SWE-rebench:一个用于软件工程代理的任务收集和净化评估的自动化管道
运维·自动化
独行soc6 小时前
2025年渗透测试面试题总结-匿名[校招]高级安全工程师(代码审计安全评估)(题目+回答)
linux·安全·web安全·面试·职场和发展·渗透测试
LB21126 小时前
Maven(黑马)
linux·服务器·maven