_int64未命名类型

时间:2011-08-24 11:18:12

标签: iphone int64 pch

在我的 pch 文件中,我有以下定义:

#if (_MSC_VER < 1300)
   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;
#else
   typedef signed __int8     int8_t;
   typedef signed __int16    int16_t;
   typedef signed __int32    int32_t;
   typedef unsigned __int8   uint8_t;
   typedef unsigned __int16  uint16_t;
   typedef unsigned __int32  uint32_t;
#endif
typedef signed __int64       int64_t;
typedef unsigned __int64     uint64_t;  

当我构建我的应用程序时,我在

处收到错误
typedef signed __int64       int64_t;
typedef unsigned __int64     uint64_t; 

表示 _int64未命名类型。可能是什么问题?

2 个答案:

答案 0 :(得分:8)

添加此包含

#include <inttypes.h>

然后使用uint64_t或int64_t。

见下文

#include <inttypes.h>


#if (_MSC_VER < 1300)
   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;
#else
   typedef signed __int8     int8_t;
   typedef signed __int16    int16_t;
   typedef signed __int32    int32_t;
   typedef unsigned __int8   uint8_t;
   typedef unsigned __int16  uint16_t;
   typedef unsigned __int32  uint32_t;
#endif
typedef signed __int64       int64_t;
typedef unsigned __int64     uint64_t;  

答案 1 :(得分:4)

您似乎正在尝试使用GCC特定的__int64类型的MSVC。这不起作用,请改用long long