GCC预处理器输出和一次编译 [英] GCC preprocessor output and compilation in one pass
本文介绍了GCC预处理器输出和一次编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似于:
<$>
有可能通过GCC一步生成预处理器输出和编译吗? p $ p> gcc -E -c main.cc -o main.o
<这会产生main.o和main.i。
解决方案
是的。 $ b
看看 gcc
-save-temps
选项。
它编译源文件并将预处理结果保存在 .i
文件中。 (它还将汇编阶段的结果保存到 .s
文件中)。
gcc -save-temps -c main.cc -o main.o
会生成 main.o
,但也是 main.i
和 main.s
。
$ b
main.i
是预处理的结果。
Is it possible to generate preprocessor output and compilation in one step with GCC?
Something like:
gcc -E -c main.cc -o main.o
that would generate main.o and main.i
解决方案
Yes.
Look at gcc
-save-temps
option.
It compiles the source file and saves the result of the preprocessing in a .i
file. (It also saves the result of the assembler phase to a .s
file).
gcc -save-temps -c main.cc -o main.o
will generate main.o
but also main.i
and main.s
.
main.i
is the result of the preprocessing.
这篇关于GCC预处理器输出和一次编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文