FFMpeg中的实例output_example.c的编译
2008-01-18 21:25
295 查看
FFMpeg中的实例output_example.c的编译
关于ffmpeg在windows上的编译,在www.ffmpeg.com.cn上有详细的讲解,在成功编译好ffmpeg后,便在MSVC中编译ffmpeg自带的实例output_example.c。
首先自己在MSVC下建立一个空的控制台的应用程序,将output_example.c加入到工程中。由于在MSVC中是使用编译ffmpeg时生产的.lib和.dll文件,所以我们需要连接它们。在这里我们需要avcodec-51.lib、avformat-51.lib和avutil-49.lib这三个静态库,故在我们编译工程之前就将它们加到工程中。
编译会发现提示: Cannot open include file: 'inttypes.h': No such file or directory 的出错信息,可通过如下方法解决:
1、找到include目录中的ffmpeg/common.h
2、在“#define COMMON_H”之后加入如下代码,同时删除“#include <inttypes.h>” 然后保存:
再次编译出现错误
error C2054: 在“inline”之后应输入“(”
这样一系列错误,我们只要在“#define COMMON_H”之后加入如下代码
#if defined(WIN32) && !defined(__cplusplus)
#define inline __inline
#endif
再次编译发现出现error LNK2019: 无法解析的外部符号_snprintf,该符号在函数_main 中被引用
这个连接错误(注意要是没有将开头说的那三个库先加入,这儿出现的连接错误更多)。
分析后知道错误是由第470行
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
引起的,解决方案如下:
MSVC 2005:
修改为_snprintf_s(oc->filename, _countof(oc->filename), 1024, "%s", filename);
MSVC 6.0
修改为_snprintf(oc->filename, sizeof(oc->filename), "%s", filename)。
关于ffmpeg在windows上的编译,在www.ffmpeg.com.cn上有详细的讲解,在成功编译好ffmpeg后,便在MSVC中编译ffmpeg自带的实例output_example.c。
首先自己在MSVC下建立一个空的控制台的应用程序,将output_example.c加入到工程中。由于在MSVC中是使用编译ffmpeg时生产的.lib和.dll文件,所以我们需要连接它们。在这里我们需要avcodec-51.lib、avformat-51.lib和avutil-49.lib这三个静态库,故在我们编译工程之前就将它们加到工程中。
编译会发现提示: Cannot open include file: 'inttypes.h': No such file or directory 的出错信息,可通过如下方法解决:
1、找到include目录中的ffmpeg/common.h
2、在“#define COMMON_H”之后加入如下代码,同时删除“#include <inttypes.h>” 然后保存:
#if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) # define CONFIG_WIN32 #endif #if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(EMULATE_INTTYPES) # define EMULATE_INTTYPES #endif #ifndef EMULATE_INTTYPES # include <inttypes.h> #else typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; # ifdef CONFIG_WIN32 typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; # else /* other OS */ typedef signed long long int64_t; typedef unsigned long long uint64_t; # endif /* other OS */ #endif /* EMULATE_INTTYPES */
再次编译出现错误
error C2054: 在“inline”之后应输入“(”
这样一系列错误,我们只要在“#define COMMON_H”之后加入如下代码
#if defined(WIN32) && !defined(__cplusplus)
#define inline __inline
#endif
再次编译发现出现error LNK2019: 无法解析的外部符号_snprintf,该符号在函数_main 中被引用
这个连接错误(注意要是没有将开头说的那三个库先加入,这儿出现的连接错误更多)。
分析后知道错误是由第470行
snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
引起的,解决方案如下:
MSVC 2005:
修改为_snprintf_s(oc->filename, _countof(oc->filename), 1024, "%s", filename);
MSVC 6.0
修改为_snprintf(oc->filename, sizeof(oc->filename), "%s", filename)。
相关文章推荐
- FFMpeg中的实例output_example.c的编译
- ffmpeg基础与编译_在VS2008下调试output_example.c(详细步骤)
- vs2010配置FFMPEG SDK并编译output_example.c遇到的问题
- FFmpeg SDK使用实例output_example的分析之一
- 关于编译ffmpeg的output-example.c和api-example.c 错误的一些解决方法
- FFmpeg SDK使用实例output_example的分析之二
- ffmpeg基础与编译_在VS2008下调试output_example.c(详细步骤)
- 【zz】编译ffmpeg的output-example.c和api-example.c 错误
- FFMpeg的output_example.c例子分析
- 使用ffmpeg sdk v3.2和vc6.0编译output_example.c
- 编译output-example.c
- 编译output-example.c
- ffmpeg的api-example.c的编译
- 使用ffmpeg sdk v3.2和vc6.0编译output_example.c
- FFMpeg的output_example.c例子分析
- FFMpeg的output_example.c例子分析
- 在VS2010下调试ffmpeg output_example.c详细步骤
- 自制FFmpeg SDK并使用output_example测试
- FFmpeg SDK使用实例apiexample的分析
- FFMpeg的output_example.c例子分析