#ifdef _WIN32 //define something for Windows (32-bit and 64-bit, this part is common) #ifdef _WIN64 //define something for Windows (64-bit only) #else //define something for Windows (32-bit only) #endif #endif
2.Linux平台
#ifdef __linux__ //define something for linux #endif
3.其它平台
#ifdef __APPLE__ #ifdef TARGET_IPHONE_SIMULATOR // iOS Simulator #endif #elif TARGET_OS_IPHONE // iOS device #elif TARGET_OS_MAC // Other kinds of Mac OS #elif __ANDROID__ // android #elif __unix__ // all unices not caught above // Unix #endif