【发布时间】:2019-01-08 02:06:04
【问题描述】:
例如: 在 my.h 文件中,我包含了 nest1.h
#ifndef MY_H
#define MY_H
#include nest1.h
...
some_function_declaration
...
#endif
在nest1.h中,我包含了另一个h文件nest2.h
#ifndef NEST1_H
#define NEST1_H
#include nest2.h
...
#endif
nest2.h
#ifndef NEST2_H
#define NEST2_H
int foo();
#endif
预处理器会将 foo() 复制到 my.h 中吗?我可以在 my.cc 文件中使用 foo() 吗? 如果nest2.h包含nest3.h,my.cc可以使用nest3.h中的函数吗?为什么? 如果有人知道答案,也请链接相关文章。谢谢!
【问题讨论】:
-
有些编译器有一个选项可以查看预处理后的结果,g++是-E
标签: c++