mir*_*irt 9 c++ g++ c-preprocessor
我想只获得预处理版本file.cc.我做了g++ -E file.cc,得到了:
# 1 "file.cc"
# 1 "<command-line>"
# 1 "file.cc"
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
And*_*ter 15
假设您的源文件包含一个简单的main函数:
$ cat file.cc
int main() {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
然后,使用您显示的命令,输出如下所示:
$ g++ -E file.cc
# 1 "file.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "file.cc"
int main() {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
问题中显示的输出在file.cc空时发生.请注意,"empty"表示文件仍然可以包含注释或#ifdef具有计算结果为false的条件的块 - 因为预处理器将它们过滤掉,它们也不会出现在输出中.
如果您不想使用行标记,请使用-P选项:
-P
Inhibit generation of linemarkers in the output from the preprocessor. This might
be useful when running the preprocessor on something that is not C code, and will
be sent to a program which might be confused by the linemarkers.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21936 次 |
| 最近记录: |