头文件test.h中添加
extern const int a;
cpp文件test.cpp中添加
#include "test.h"
const int a = 0;
main.cpp
#include "test.h"
int main()
{
a;
}
编译时a不是一个编译时常量,main.cpp有可能先编译,此时a未定义会产生报错。
最后
以上就是儒雅香烟最近收集整理的关于compile time constant 编译时常量的全部内容,更多相关compile内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复