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>
}
相关推荐
程序员小胡061938 分钟前
操作系统系统面试常问(进程、线程、协程相关知识)
linux·面试·职场和发展
小张是铁粉1 小时前
linux配置nvc远程连接
linux·服务器·centos
知北游天1 小时前
Linux:多线程---深入生产消费模型&&环形队列生产消费模型
linux·缓存
阿巴~阿巴~2 小时前
Linux“一切皆文件“设计哲学 与 Linux文件抽象层:struct file与file_operations的架构解析
linux·运维·服务器
小哈里3 小时前
【管理】持续交付2.0:业务引领的DevOps-精要增订本,读书笔记(理论模型,技术架构,业务价值)
运维·架构·devops·管理·交付
kfepiza3 小时前
`/etc/samba/smb.conf`笔记250721
linux·网络协议
beyoundout3 小时前
LVS(Linux virtual server)-实现四层负载均衡
linux·服务器·lvs
Spike()3 小时前
LVS工作模式和算法的总结
linux·服务器·lvs
禁默3 小时前
《命令行参数与环境变量:从使用到原理的全方位解析》
linux
沙老师3 小时前
删除debian xdm自启动ibus的配置项
运维·服务器·debian