c++ - Qt框架使用ffmpeg库报错

标签 c++ linux c++11 ffmpeg qt4

当我包含时:

extern "C" {
#include <libavcodec/avcodec.h>
}

我收到错误:

undefined reference to QVideoSurfaceFormat::QVideoSurfaceFormat(QSize const&, QVideoFrame::AVPixelFormat, QAbstractVideoBuffer::HandleType)

没有包含 - 构建成功。

我的猜测是 include 带来了一些破坏 QVideoSurfaceFormat defenition 的定义。
有人遇到过类似的问题吗?

最佳答案

#define __STDC_CONSTANT_MACROS // to fix #include <stdint.h> issue
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}

在阅读 stdint.h 和网络上的相关主题后,找到了适合我的解决方案:

#define __STDC_CONSTANT_MACROS

关于c++ - Qt框架使用ffmpeg库报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53512910/

相关文章:

c++ - 删除从函数返回的唯一指针?

c++ - 将列表继承到超出范围的可排序列表保护成员

C++ while循环,测试多个数组的下标

c++ - 字符串连接错误

在c中捕获一个退出线程

c++ - 延迟特定时间的方法调用

C++ Qt QString 用一个替换双反斜杠

linux - bash 脚本将文本附加到文件的第一行

c++ - 使用可变修改类型实例化模板

c++ - 我可以避免在一系列函数调用中使用模板消歧器吗?