具有参数“g -save-temps”的gcc将中间文件放入当前目录 [英] gcc with parameters "-S -save-temps" puts intermediate files in current directory
问题描述
参数 -S -save-temps
可以正常工作,只要我不在具有相同名称的文件上使用它们即可。
考虑以下情况:我有一个名为 这是预期的行为,因为 我的问题是,我正在进行事先不知道的项目。很可能,有人在他的Makefiles中构建了上述示例。在这种情况下,我会被卡住,因为我需要两个中间文件。 我正在构建的系统的几个词(为了更好的理解):我的工具使用 您有任何想法,我如何能够获得每个预处理文件,即使上面提到的例子应该出现? file.cpp / file.c在不同的目录中没有问题。 GCC将根据文件的扩展名创建一个 如果他们都有c || cpp,你可以使用 The parameters Think of the following situation: I have a project with a main directory and a subdirectory with the name That is the expected behaviour, as the man file of My problem is, that I'm working on projects I don't know in advance. It could very well be, that someone constructed the above mentioned example in his Makefiles. In that case I would be stuck, because I need both intermediate files. A few words to the system I'm constructing (for better understanding): My tool uses Do you have any ideas, how I'm able to get every preprocessed file, even if the above mentioned example should appear? There's no problem with file.cpp / file.c in different directories. GCC will create a If they both have c||cpp you can use 这篇关于具有参数“g -save-temps”的gcc将中间文件放入当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! subDir
的主目录和子目录的项目,并且这两个目录都是文件放置名称 file.c
。如果我现在调用 gcc -S -save-temps file.cpp subDir / file.c
,只有一个中间文件名为 file.i
将被生成。
gcc
的man文件告诉我使用 -save-temps
。
make --just-print
来收集调用,一个项目的make文件调用。我扫描这些调用以进行编译调用,并添加 -save-temps
和 -S
选项。其目的是获取每个预处理文件,这是在编译项目过程中使用的。
*。ii
和一个 *。i
。
-E
并且只接收一个 *。i
您可以在其中搜索pragma #1< FILE_PATH>
并通过脚本提取它。-S -save-temps
work fine, as long as i don't use them on files with the same name.subDir
and in both of the directories are files placed with the name file.c
. If I now call gcc -S -save-temps file.cpp subDir/file.c
only one intermediate file with the name file.i
will be generated.gcc
tells me, that the intermediate files will always be placed in the current path, when using -save-temps
.make --just-print
to collect the calls, a make file of a project invokes. I scan these calls for compiler calls and add the -save-temps
and -S
options. The purpose is to get every preprocessed file, that is used in the process of compiling the project.*.ii
and a *.i
depending on the files' extension.-E
and receive only one *.i
where you can search for the pragma # 1 "<FILE_PATH>"
and extract it via a script.