區分各種編譯器與操做系統的宏

轉載自:http://blog.csdn.net/wulibin136/article/details/6358521linux

 

    • 編譯器
      • 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  _WIN64
      • GUI  App
        #ifdef  _WINDOWS 
      • CUI  App
        #ifdef  _CONSOLE
      • Windows的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_WCE
      • Windows CE … WINCEOSVER
      • Windows CE
        WCE_IF
      • Int ernet Explorer的Ver … _WIN32_IE 
    • Cygwin
      • Cygwin
        #ifdef  __CYGWIN__
      • 32bit版Cygwin(如今好像尚未64bit版)
        #ifdef  __CYGWIN32__
      • MinGW(-mno-cygwin指定)
        #ifdef  __MINGW32__
相關文章
相關標籤/搜索