标准头文件的写法(防止多次添加同一头文件产生错误)

来源:互联网 发布:win7桌面网络图标不见 编辑:程序博客网 时间:2024/05/29 16:22
方式一:
#ifndef _SOMEFILE_H_
#define _SOMEFILE_H_
.......... // 一些声明语句
#endif
方式二:
#pragma once
... ... // 一些声明语句
如果使用时出现以下情况也不会出错:
#include "Test1.h"      // line 1
#include "Test1.h"      // line 2
0 0
原创粉丝点击