不同操作系统相关的宏

1. win32或者win64

_WIN32 Defined as 1 when the compilation target is 32-bit ARM, 64-bit ARM, x86, or x64. Otherwise, undefined.

_WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64. Otherwise, undefined.

#if defined(_WIN32)
#define OS_WINDOWS
#endif

2. linux

#if defined(__linux__)
#define OS_LINUX
#endif

3. macOS

#if defined(__APPLE__)
#define OS_LINUX // macOS does not differ that much from linux
#define OS_MACOS
#endif

4. QNX

__QNX__
The target is a QNX operating system (QNX 4, QNX Neutrino, or BlackBerry PlayBook OS).
__QNXNTO__
The target is the QNX Neutrino RTOS or BlackBerry PlayBook OS.
#if defined(__QNX__)
   /* QNX-specific (any flavor) code here */

   #if defined(__QNXNTO__)
      /* QNX Neutrino-specific code here */
   #else
      /* QNX 4-specific code here */
   #endif
#endif
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容