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>
}
相关推荐
鸢尾掠地平11 分钟前
DNS的正向、反向解析的服务配置知识点及实验
运维·服务器·网络
by__csdn25 分钟前
nvm命令使用,nvm国内镜像,nvm命令for Linux/Mac
linux·运维·macos
su3171 小时前
rap2部署
linux·运维·服务器
敲不响的键盘1 小时前
Nginx Location匹配与Proxy_pass匹配规则
运维·nginx
wheeldown1 小时前
【Linux】Linux 地址空间 + 页表映射的概念解析
java·linux·jvm
陌路201 小时前
操作系统(11)进程描述与控制--5种IO状态(1)
linux·ubuntu
skywalk81631 小时前
阿里云服务器FreeBSD新系统从登录、配置到升级:从14.1升级到FreeBSD 14.3 Release
linux·服务器·阿里云·freebsd
草莓熊Lotso1 小时前
Linux 基础开发工具入门:软件包管理器的全方位实操指南
linux·运维·服务器·c++·人工智能·网络协议·rpc
Jewel Q2 小时前
PowerShell 和 CMD
运维
喜欢吃燃面2 小时前
Linux:make自动化和实战演练
linux·学习