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>
}
相关推荐
MDM.Plus2 分钟前
苹果MDM技术演进:从远程控制到设备信任体系的构建
运维·服务器·安全·ios·mdm·手机店
REDcker10 分钟前
macOS 挂载 Linux 远程目录详解
linux·运维·macos
2601_9615934213 分钟前
Mac 上搭建Linux环境吗?VMware + CentOS Stream 9 镜像快速部署
linux·运维·ide·macos·centos
dddwjzx17 分钟前
嵌入式Linux C应用编程入门——线程 (二)
linux·嵌入式
写代码的学渣28 分钟前
Linux systemd 开机启动日志逐行详细解析报告
linux·运维·服务器
田里的水稻1 小时前
EP_XML\JSON配置文件和YAML
xml·运维·人工智能·机器人·自动驾驶·json
阿成学长_Cain1 小时前
Linux telinit 命令详解:运行级别切换|关机重启|系统维护一站式掌握
linux·运维·前端·网络
QXWZ_IA2 小时前
油气储罐沉降监测用什么技术方案最好?千寻自动化监测+次声波泄漏方案
运维·科技·自动化·能源
qeen873 小时前
【Linux】指令补充与shell的简单介绍
linux·运维·服务器
DLYSB_3 小时前
《从零开始搭建机房轻量化“声光告警”系统:基于 HTTP API 与 TTS 的运维实践》
运维·网络协议·http·报警灯