2011-08-24 11 views
7

Nel mio PCH lima Ho le seguenti definizioni:_int64 non nomina un tipo

#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; 

Quando costruisco la mia domanda ho un errore a

typedef signed __int64  int64_t; 
typedef unsigned __int64  uint64_t; 

che dice che _int64 non nomina un tipo. Quale potrebbe essere il problema?

risposta

8

Aggiungi questo includono

#include <inttypes.h> 

Quindi utilizzare uint64_t o int64_t.

vedi sotto

#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; 
+0

Non è necessario scrivere typedef firmato __? – Nitish

+0

dopo che se usi ovunque int64_t allora il compilatore comprenderà firmato __int64 –

+0

Questo non funziona. Ancora errori. – Nitish

4

Sembra che tu stia cercando di utilizzare il tipo specifico MSVC __int64 con GCC. Non funziona, usa invece long long.

+0

In realtà io sto costruendo [questo] il codice (http://code.google.com/p/idoubs/wiki/Building_iDoubs_v2_x). – Nitish

Problemi correlati