同时使用ffmpeg库和SDL库,数据类型使用出现冲突:
编译出错:
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(36) : error C2371: 'int8_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(15) : see declaration of 'int8_t'
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(37) : error C2371: 'uint8_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(16) : see declaration of 'uint8_t'
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(38) : error C2371: 'int16_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(17) : see declaration of 'int16_t'
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(39) : error C2371: 'uint16_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(18) : see declaration of 'uint16_t'
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(40) : error C2371: 'int32_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(19) : see declaration of 'int32_t'
d:\program files\microsoft visual studio\vc98\include\sdl\sdl_config_win32.h(41) : error C2371: 'uint32_t' : redefinition; different basic types
e:\重要的版本和文档\测试视频播放_各版本\测试视频播放\ffmpeg\include\inttypes.h(20) : see declaration of 'uint32_t'
原因是inttypes.h和sdl_config_win32.h同时定义了'int8_t','uint8_t'。。。。
解决方法:加入#ifndef xxx #define xxx #endif
inttypes.h
#ifndef _STDINT_H
#define _STDINT_H
#define __need_wint_t
#define __need_wchar_t
#include <stddef.h>
/* 7.18.1.1 Exact-width integer types */
#ifndef _datatype_
#define _datatype_
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned uint32_t;
#endif
#ifdef __GNUC__
typedef long long int64_t;
typedef unsigned long long uint64_t;
#else
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
sdl_config_win32.h
#ifndef _SDL_config_win32_h
#define _SDL_config_win32_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
#if defined(__GNUC__) || defined(__DMC__)
#define HAVE_STDINT_H 1
#elif defined(_MSC_VER)
#ifndef _datatype_
#define _datatype_
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
#endif
这样就会搞定!