C语言ifndefine

2566阅读 0评论2010-07-27 tianchunlong
分类:C/C++

#ifndefine   NAME_H_
#define   NAME_H_  
class   Stact
{
    public:
      Stcat();
      ~Stcat();
    //..............
    protced:
        char*   str;
        int   a;
}

#endif

防止重复include的情况:
比如:
a.h:
#include   "name.h "
.....


b.h:
#include   "name.h "
#include   "a.h "
......

如果没有#ifndef   NAME_H_
#define   NAME_H_
#endif
这种机制,则会造成编译时出错(class   Stact重复定义)
上一篇:Linux下的段错误产生的原因及调试方法
下一篇:linux消息队列函数msgget,msgsnd, msgrcv, ftok()