区分操作系统的一些宏

    xiaoxiao2026-09-24  15

    转载自http://blog.sina.com.cn/s/blog_4fcd1ea30100ui78.html

    编码的时候经常要用到条件编译,每次都到网上去查比较浪费时间,今天总结一下以备后用

    编译器 GCC #ifdef  __GNUC__ #if __GNUC__ >= 3 // GCC3.0以上 Visual C++ #ifdef  _MSC_VER(非VC编译器很多地方也有定义) #if _MSC_VER >=1000 // VC++4.0以上#if _MSC_VER >=1100 // VC++5.0以上#if _MSC_VER >=1200 // VC++6.0以上#if _MSC_VER >=1300 // VC2003以上#if _MSC_VER >=1400 // VC2005以上 Borland  C++ #ifdef  __BORLANDC__ UNIX UNIX #ifdef  __unix or #ifdef  __unix__Linux #ifdef  __linux or #ifdef  __linux__FreeBSD #ifdef  __FreeBSD__NetBSD #ifdef  __NetBSD__ Windows 32bit #ifdef  _WIN32(或者WIN32)64bit #ifdef  _WIN64GUI  App #ifdef  _WINDOWS CUI  App #ifdef  _CONSOLEWindows的Ver … WINVER ※ PC机Windows(95/98/Me/NT/2000/XP/Vista)和Windows CE都定义了 #if (WINVER >= 0x030a) // Windows 3.1以上#if (WINVER >= 0x0400) // Windows 95/NT 4.0以上#if (WINVER >= 0x0410) // Windows 98以上#if (WINVER >= 0x0500) // Windows Me/2000以上#if (WINVER >= 0x0501) // Windows XP以上#if (WINVER >= 0x0600) // Windows Vista以上 Windows 95/98/Me的Ver … _WIN32_WINDOWS MFC App、PC机上(Windows CE没有定义) #ifdef  _WIN32_WINDOWS#if (_WIN32_WINDOWS >= 0x0400) // Windows 95以上#if (_WIN32_WINDOWS >= 0x0410) // Windows 98以上#if (_WIN32_WINDOWS >= 0x0500) // Windows Me以上 Windows NT 的Ver … _WIN32_WINNT #if (_WIN32_WINNT  >= 0x0500) // Windows 2000以上#if (_WIN32_WINNT  >= 0x0501) // Windows XP以上#if (_WIN32_WINNT  >= 0x0600) // Windows Vista以上 Windows CE(PocketPC ) #ifdef  _WIN32_WCEWindows CE … WINCEOSVERWindows CE WCE_IFInt ernet Explorer的Ver … _WIN32_IE  Cygwin Cygwin #ifdef  __CYGWIN__32bit版Cygwin(现在好像还没有64bit版) #ifdef  __CYGWIN32__MinGW(-mno-cygwin指定)

    #ifdef  __MINGW32__

    转载请注明原文地址: https://ju.6miu.com/read-1312288.html
    最新回复(0)