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>
}
相关推荐
取经蜗牛3 小时前
Ubuntu 国内镜像源配置指南(多版本常用镜像地址都有)
linux·运维·ubuntu
实心儿儿4 小时前
Linux —— 线程控制(1)
linux·运维·服务器
筠筠喵呜喵4 小时前
Linux软件开发性能优化
linux·c++·性能优化
Bruce_kaizy4 小时前
c++ linux环境编程——文件io介绍以及open 、write 、read 三剑客深度详解
linux·服务器·c++·ubuntu·操作系统·文件io
亦良Cool5 小时前
VMware虚拟机ubuntu瘦身,解决虚拟机越用越大
linux·运维·ubuntu
星辰&与海6 小时前
KVM + QEMU虚拟化方案
linux·运维
宋浮檀s6 小时前
应急响应——恶意流量&攻击行为识别
linux·运维·网络·网络安全·应急响应
REDcker6 小时前
Linux OverlayFS详解
java·linux·运维
zizle_lin7 小时前
WSL的系统安装和部分环境配置(按需操作)
运维
lwx9148527 小时前
Linux系统中用户锁定后如何解锁
linux·运维·服务器