error C2371: 'int8_t' : redefinition; different basic types;see declaration of 'int8_t'

同时使用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

这样就会搞定!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值