各C++编译器预定义配置

来源:互联网 发布:网站流量提升软件 编辑:程序博客网 时间:2024/05/17 00:50
#ifndef XConfigH
#define XConfigH
/*
 2006-2-7 配置使用的宏
 zdhsoft
*/
/*
 关于VC的宏开关
*/
#ifdef _MSC_VER
 #define CONFIG_BCB  0
 #define CONFIG_BCB5  0
 #define CONFIG_BCB6  0
 #define CONFIG_BCB2006 0
 #define CONFIG_GCC  0
 #define CONFIG_GCC2X 0
 #define CONFIG_GCC3X 0
 #define CONFIG_GCC4X 0
 #define CONFIG_VC   1
 #if _MSC_VER == 1200
  #define CONFIG_VC5  0
  #define CONFIG_VC6  1
  #define CONFIG_VC2001 0
  #define CONFIG_VC2003 0
  #define CONFIG_VC2005 0
 #elif _MSC_VER == 1310
  #define CONFIG_VC5  0
  #define CONFIG_VC6  0
  #define CONFIG_VC2001 0
  #define CONFIG_VC2003 1
  #define CONFIG_VC2005 0
 #elif _MSC_VER == 1400
  #define CONFIG_VC5  0
  #define CONFIG_VC6  0
  #define CONFIG_VC2001 0
  #define CONFIG_VC2003 0
  #define CONFIG_VC2005 1
 #else
  #define CONFIG_VC5  0
  #define CONFIG_VC6  0
  #define CONFIG_VC2001 0
  #define CONFIG_VC2003 0
  #define CONFIG_VC2005 0
 #endif
#endif
#ifdef __BORLANDC__
 #define CONFIG_BCB   1
 #define CONFIG_VC   0
 #define CONFIG_VC5   0
 #define CONFIG_VC6   0
 #define CONFIG_VC2001  0
 #define CONFIG_VC2003  0
 #define CONFIG_VC2005  0
 #define CONFIG_GCC   0
 #define CONFIG_GCC2X  0
 #define CONFIG_GCC3X  0
 #define CONFIG_GCC4X  0

 #if __BORLANDC__  >= 0x0560 && __BORLANDC__ <= 0x0569
  #define CONFIG_BCB5  0
  #define CONFIG_BCB6  1
  #define CONFIG_BCB2006 0
 #elif __BORLANDC__ >= 0x0550 && __BORLANDC__ <= 0x0559
  #define CONFIG_BCB5  1
  #define CONFIG_BCB6  0
  #define CONFIG_BCB2006 0
 #elif __BORLANDC__ >= 0x0570
  #define CONFIG_BCB5  0
  #define CONFIG_BCB6  0
  #define CONFIG_BCB2006 1
 #else
  #define CONFIG_BCB5  0
  #define CONFIG_BCB6  0
  #define CONFIG_BCB2006 0
 #endif
#endif
#ifdef __GNUC__
 #define CONFIG_BCB   0
 #define CONFIG_BCB5   0
 #define CONFIG_BCB6   0
 #define CONFIG_BCB2006  0
 #define CONFIG_VC   0
 #define CONFIG_VC5   0
 #define CONFIG_VC6   0
 #define CONFIG_VC2001  0
 #define CONFIG_VC2003  0
 #define CONFIG_VC2005  0
 #define CONFIG_GCC   1
 #if __GNUC__ == 2
  #define CONFIG_GCC2X 1
  #define CONFIG_GCC3X 0
  #define CONFIG_GCC4X 0
 #elif __GNUC__ == 3
  #define CONFIG_GCC2X 0
  #define CONFIG_GCC3X 1
  #define CONFIG_GCC4X 0
 #elif __GNUC__ == 4
  #define CONFIG_GCC2X 0
  #define CONFIG_GCC3X 0
  #define CONFIG_GCC4X 1
 #else
  #define CONFIG_GCC2X 0
  #define CONFIG_GCC3X 0
  #define CONFIG_GCC4X 0
 #endif
#endif
/*
 调试开关,有些地方会用到调试信息。
*/
#define CONFIG_DEBUG    0
//多线程开关
#define CONFIG_MULT_THREAD 1
/*
 关于各种指定的开关
*/
/*
 关于CPU类型的开关
*/
#define TEST_CONFIG 0
#if TEST_CONFIG
#include <stdio.h>
void printf_cpp_define()
{
 printf("CONFIG_VC = %d/n",CONFIG_VC);
 printf("CONFIG_VC5 = %d/n",CONFIG_VC5);
 printf("CONFIG_VC6 = %d/n",CONFIG_VC6);
 printf("CONFIG_VC2001 = %d/n",CONFIG_VC2001);
 printf("CONFIG_VC2003 = %d/n",CONFIG_VC2003);
 printf("CONFIG_VC2005 = %d/n",CONFIG_VC2005);
 printf("CONFIG_BCB = %d/n",CONFIG_BCB);
 printf("CONFIG_BCB5 = %d/n",CONFIG_BCB5);
 printf("CONFIG_BCB6 = %d/n",CONFIG_BCB6);
 printf("CONFIG_BCB2006 = %d/n",CONFIG_BCB2006);
 printf("CONFIG_GCC = %d/n",CONFIG_GCC);
 printf("CONFIG_GCC2X = %d/n",CONFIG_GCC2X);
 printf("CONFIG_GCC3X = %d/n",CONFIG_GCC3X);
 printf("CONFIG_GCC4X = %d/n",CONFIG_GCC4X);
}
#endif
#endif
 
原创粉丝点击