简体   繁体   中英

typedef redefinition error Xcode 5, iOS7 and 64bit vs 32bit

I am trying to build an existing project of 32 bit in 64bit ios 7 using xcode 5. During build time with architecture arm64 , typedef redefinition error occurs . Xcode 5 llvm compiler shows the redine error. In below I post the sample code where I got error mainly.

#if defined (__LP64__)

typedef long int64_t;

typedef unsigned long u_int64_t;
#else

typedef long long          int64_t;
 //shows redefine error int64_t long vs long long

typedef unsigned long long u_int64_t; 
//shows redefine error u_int64_t unsigned long vs unsigned long long 
#endif

You can simply remove these definitions from your code. Both int64_t and u_int64_t are already defined in the iOS SDK headers. (If necessary, add #include <stdint.h> , which is the standard header for exact-width integer types.)

The the error actually occurs in the first part of your code when compiling for 64-bit, because your definitions

typedef long int64_t;
typedef unsigned long u_int64_t;

conflict with the iOS SDK definitions

typedef long long       int64_t;
typedef unsigned long long  u_int64_t;

since long and long long are different types (but of the same size on 64-bit ARM).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM