如何使用类似于#ifndef 的头文件啊?谢谢 ================我是菜鸟|!

解决方案 »

  1.   

    比如
    #ifndef VERSION5
        #include <version4.h>
    #else
        #include <version5.h>
    #endif
      

  2.   

    噢 没看清标题..
    比如上面几句吧 你主要是根据ifndef 和 else 所作的工作来决定需要定义哪个宏
      

  3.   

    #ifndef 是用来判断一个宏有没有定义,如果没有定义就为true#define IAMHERO#ifndef IAMHERO
     #include"iamhero.h"
    #else
     #include "iamsuperhero.h"
    就会包含"iamhero.h"
    如果去掉#define IAMHERO就会包含#include "iamsuperhero.h"
      

  4.   

    是不是说如果#define IAMHERO
    没定义,条件为真,执行#include"iamhero.h"否则执行:#include "iamsuperhero.h"是这样吗?
      

  5.   

    #if !defiend(__MYHEAD__)
    #define __MYHEAD__......
    #endif