说明

  • 编译环境: mac osx 10.14 + cmake + clang++
  • 写了一个简单c++的范例调用ffmpeg函数完成音频采集

出错提示

[build] /usr/local/ffmpeg/include/libavutil/common.h:30:2: error: missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
[build] #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
[build] ^
[build] 1 error generated.
[build] make[2]: *** [CMakeFiles/ffmpeg_demo.dir/example/main.cc.o] Error 1
[build] make[1]: *** [CMakeFiles/ffmpeg_demo.dir/all] Error 2

解决办法

  • clang 提示的很明显: 需 定义宏 __STDC_CONSTANT_MACROS
  • 引文ffmpeg库中的函数是C语言,而我是用的c++调用。
  • __STDC_CONSTANT_MACROS 一定要放在 include 之前
#define __STDC_CONSTANT_MACROS
extern "C"{
#include "/usr/local/ffmpeg/include/libavutil/log.h"
#include <libavformat/avformat.h>
#include <libavdevice/avdevice.h>
}

ffmpeg(1)之libavutil/common.h:30:2: error: missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS的更多相关文章

  1. 调用ffmpeg库编译时出现common.h:175:47: error: 'UINT64_C' was not declared in this scope

    解决办法 出现错误:jni/ffmpeg/libavutil/common.h:175:47: error: 'UINT64_C' was not declared in this scope 解决: ...

  2. 用g++ 编译 ffmpeg 编译出现 error: 'UINT64_C' was not declared in this scope 或 missing -D__STDC_CONSTANT_MACROS

    在 libavutil/common.h 下 添加如下,即可解决 #ifdef __cplusplus#define __STDC_CONSTANT_MACROS#ifdef _STDINT_H#un ...

  3. ffmpeg解码RTSP/TCP视频流H.264(QT界面显示视频画面)

    源码下载地址: http://download.csdn.net/detail/liukang325/9489952 我用的ffmpeg版本为 ffmpeg-2.1.8.tar.bz2 版本低了恐怕有 ...

  4. libavcodec/dxva2.h:40:5: error: unknown type name 'IDirectXVideoDecoder'

    gcc 4.9.2 编译 ffmpeg-git-1aeb88b 是出现如下错误 > FFmpeg fails to make with: > > CC libavcodec/dxva ...

  5. redis make时 提示 zmalloc.h:50:31: error: jemalloc/jemalloc.h:

    redis安装需要环境必备 gcc 但是若未先安装好gcc,make失败后再次 make 会提示如下错误 zmalloc.h:50:31: error: jemalloc/jemalloc.h: 这时 ...

  6. error CS0007: Unexpected common language runtime initialization error -- '没有注册类别 '

    Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]"Inst ...

  7. afx.h(78): fatal error C1083: 无法打开包括文件: “new.h”: No such file or directory

    vs2015新建mfc工程,编译错误: D:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include\afx.h(78): ...

  8. abp Cannot access a disposed object. A common cause of this error is disposing

    框架:abp 异常信息: An unhandled exception was thrown by the application.System.ObjectDisposedException: Ca ...

  9. ../include/squid_md5.h:27:2: error: #error Cannot find OpenSSL MD5 headers【squid安装中】

    ../include/squid_md5.h:27:2: error: #error Cannot find OpenSSL MD5 headers yum install -y openssl* w ...

随机推荐

  1. Codeforces 700D - Huffman Coding on Segment(莫队+根分)

    Codeforces 题目传送门 & 洛谷题目传送门 好家伙,刚拿到此题时我连啥是 huffman 编码都不知道 一种对 \(k\) 个字符进行的 huffman 编码的方案可以看作一个由 \ ...

  2. curl实现SFTP上传下载文件

    摘自:https://blog.csdn.net/swj9099/article/details/85292444 #include <stdio.h> #include <stdl ...

  3. NextDenovo 组装基因组

    NextDenovo 是有武汉未来组团队开发出来用于组装ONT,Pacbio, HIFI (默认参数可对60-100X数据更有效),可通过correct--assemble对其进行组装.组装后,每个碱 ...

  4. 巩固javaweb第十二天

    巩固内容: HTML 图像- 图像标签( <img>)和源属性(Src) 在 HTML 中,图像由<img> 标签定义. <img> 是空标签,意思是说,它只包含属 ...

  5. nuxt.js相关随笔

    对于nuxt.js从未接触,对于项目需要进行零散了解,作此归纳,以下都是一个新手的拙见与理解,有不同意见欢迎提出,但请勿喷. 一.项目创建 npx create-nuxt-app projectNam ...

  6. Scala【json字符串和json对象互相转换】

    一.fastjson工具 pom依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>f ...

  7. 转 关于HttpClient,HttpURLConnection,OkHttp的用法

    转自:https://www.cnblogs.com/zp-uestc/p/10371012.html 1 HttpClient入门实例 1.1发送get请求 1 2 3 4 5 6 7 8 9 10 ...

  8. linux安装redis报错

    问题:You need tcl 8.5 or newer in order to run the Redis test 解决办法: wget http://downloads.sourceforge. ...

  9. Linux学习 - 输入输出重定向,管道符,通配符

    一.键盘输入读取read read [选项] [变量名] -p [显示信息] 在等待read输入时,输出提示信息 -t [秒数] 指定read输入等待时间 -n [字符数] 指定read只接收n个字符 ...

  10. maven常用Java配置

    maven国内镜像 ------------------------------------------------------------------------------------------ ...