预编译标头是递归的
Are precompiled headers recursive?
让我们假设我的.h文件用于创建预编译头文件如下所示:
stdafx.h
#include "A.h" //an external library
.. 和 "A.h" 包括一堆其他标头:
啊
#include "B.h" //other headers from an external library included by "A.h"
#include "C.h"
//...
是否也会为"B.h"和"C.h"生成预编译头(以及这两个文件包含的头文件,等等...),或者我是否也必须在我的"stdafx.h"中包含"B.h"和"C.h"?
是的,预编译状态将包括 B 和 C。
预编译的工作原理是运行编译器直到 stdafx.h 的末尾并将其状态转储到磁盘,然后在编译每个源文件的正文之前恢复该状态。 编译器在编译 stdafx.h 时看到的所有内容都会进入该状态。
(换句话说:编译 stdafx.h 的过程完全相同,无论您是生成预编译状态还是只是"正常"编译源文件 - 只是在预编译情况下编译器在文件末尾停止。 即使它愿意,它也不能区别对待B和C。
相关文章:
- 包含模板文件的递归会导致编译失败
- 使用 SFINAE 作为模板参数的编译时递归
- 为什么我的递归可变参数模板无法编译?
- 递归应用 C++20 范围适配器会导致编译时无限循环
- 我试图用c++编写递归fibonacci序列,但当我编译时,我遇到了一个错误
- 为什么递归 constexpr 模板值无法编译?
- 具有编译问题的简单(递归)可变参数模板"accumulate_for"函数
- 为什么使用递归lambda时会遇到编译错误
- 范围的递归函数(从范围 v3 开始)导致编译发散:为什么
- 如何制作递归编译时间变异结构模板
- 使用C 模板函数编译时间递归
- Boost.Spirit X3 编译时间因递归规则而爆炸
- 提升分配器无法在递归上下文中编译
- Intel C 编译器的编译非常慢,无法编译递归声明返回
- sudoku递归回溯,未提早编译
- 编译时间递归函数以计算两个整数的下一个功能
- 预编译标头是递归的
- 使用选择算法编译时递归排序
- 递归提升::变量类型不能用"-std=c++11 -stdlib=libc++"编译
- Makefile、递归编译和静态库