类重定义问题。。。。BSCMAKE: error BK1506 : cannot open file '.\Debug\。。。。
2011-08-02 19:21
531 查看
#ifndef CALCENG_H
#define CALCENG_H
class CalcEng
{
...
};
#endif
这种结构是避免重复包含同一个头文件,引起类的重定义。
#ifdef/#ifndef 的意思, 看看有关预处理器条件编译的部分。
这个例子中,第一次包含此文件时, 宏 CALCENG_H 还没有被定义,#ifndef CALCENG_H
的值为真,一直到相应的 #endif 之间的代码都会被编译,包括了类的定义 和 定义宏 CALCENG_H。
当在同一文件中再包含此文件,宏 CALCENG_H 已经存在,#ifndef CALCENG_H 值为假,
#ifndef 和 #endif 之间的代码就不会被编译了,从而避免了重复定义 class CalcEng。
注意:宏定义的有效范围只在一个文件中。
#define CALCENG_H
class CalcEng
{
...
};
#endif
这种结构是避免重复包含同一个头文件,引起类的重定义。
#ifdef/#ifndef 的意思, 看看有关预处理器条件编译的部分。
这个例子中,第一次包含此文件时, 宏 CALCENG_H 还没有被定义,#ifndef CALCENG_H
的值为真,一直到相应的 #endif 之间的代码都会被编译,包括了类的定义 和 定义宏 CALCENG_H。
当在同一文件中再包含此文件,宏 CALCENG_H 已经存在,#ifndef CALCENG_H 值为假,
#ifndef 和 #endif 之间的代码就不会被编译了,从而避免了重复定义 class CalcEng。
注意:宏定义的有效范围只在一个文件中。
相关文章推荐
- vc6.0 转 vs2008 时 遇到这样的错误时“BSCMAKE: error BK1506 : cannot open file './Debug/xxx.sbr': No such
- BSCMAKE: error BK1506 : cannot open file '.\Debug\Client_DM36xDlg.sbr': No such file or directory
- vc6.0 转 vs2008 时 遇到这样的错误时“BSCMAKE: error BK1506 : cannot open file './Debug/ex73View.sbr': No such file or directory”
- error BK1506 :cannot open file './Debug/C.sbr': No such file or directory
- C1803:ERROR Cannot open precompiled header file: 'Debug/XXX.pch': No such file or directory
- error BK1506 : cannot open file '.\Debug\????????.sbr': No such file or dire
- error BK1506 : cannot open file '.\Debug\????????.sbr': No such file or dire
- 关于fatal error C1083: Cannot open precompiled header file: /'Debug…….pch/': 错 问题的解决
- vc6.0常见错误fatal error C1083: Cannot open precompiled header file: 'Debug/**.pch'
- atal error C1083: Cannot open precompiled header file: 'Debug/e.pch': No such file or directory
- 【转】Cannot open precompiled header file:'Debug/password.pch' No such file or directory
- VC fatal error C1083: Cannot open precompiled header file: /'Debug/xxx.pch/':
- vc++提示cannot open include file 'afxres.h'———VC安装设置问题
- Cannot open precompiled header file: 'Debug/****.pch': No such file or directory
- Cannot open precompiled header file: 'Debug/*.pch': No such file or directory
- 解决 Cannot open precompiled header file: 'Debug/****.pch'
- vc++ 6.0 fatal error C1083: Cannot open precompiled header file: 'Debug/Hello.pch': No such file or
- fatal error C1083: Cannot open precompiled header file: 'Debug/xxoo.pch': No such file or directory
- fatal error C1083: Cannot open precompiled header file: 'Debug/Hello.pch': No such file or directory
- 错误:预编译头文件 fatal error C1083: Cannot open precompiled header file: 'Debug