#ifdef _WIN32 //define something for Windows (32-bit and 64-bit, this part is common) #ifdef _WIN64 //define something for Windows (64-bit only) #endif #elif __APPLE__ #if TARGET_IPHONE_SIMULATOR // iOS Simulator #elif TARGET_OS_IPHONE // iOS device #elif TARGET_OS_MAC // Other kinds of Mac OS #else // Unsupported platform #endif #elif __linux // linux #elif __unix // all unices not caught above // Unix #elif __posix // POSIX #endif
c++各个平台的宏定义
最新推荐文章于 2025-05-24 08:09:48 发布
本文通过示例展示了如何使用预处理器指令针对不同操作系统进行条件编译,包括Windows、苹果系统(iOS与macOS)及Linux等。该文适用于需要为多种操作系统编写兼容代码的开发者。

887

被折叠的 条评论
为什么被折叠?



