我们在哪里使用.i文件,以及如何生成它们?

问题描述:

我正在浏览GCC手册页,发现以下行:

I was going through the GCC man page, I found the following line:

 file.i
           C source code that should not be preprocessed.

我知道运行gcc -E foo.c会在预处理后停止编译器; 但是创建.i文件的实际应用是什么.

I know that running gcc -E foo.c stops the compiler after preprocessing; but what is the real world application of creating .i files.

还可以生成除gcc foo.c -E > foo.i以外的.i文件吗?

Also is there a way of generating a .i files other than gcc foo.c -E > foo.i?

.i文件也称为纯C文件".处于预处理阶段

The .i files are also called as "Pure C files". In preprocessing stage

  1. 头文件将包含在内.

  1. Header files will be included.

宏将被替换.

评论已删除.

用于条件编译. 如果查看.i文件,您会看到这些内容.

Used for conditional compilation. If you look at the .i file you can see these things.

生成.i文件的命令是-

gcc -E foo.c -o foo.i