CL的输出文件 [英] CL's output files
问题描述
大家好。
当我使用cl作为cpp文件时,它会在pwd中生成文件。我正在使用/ Fa参数(我需要asm文件)。
有一种方法可以在文件的相同路径中生成文件(即使我在子目录中有多个文件)
例如:对于文件a.cpp我想要a.asm用于sub \b.cpp - > sub \.b.asm等。
提前感谢
yoni
我所知道的唯一方法是使用多次运行cl.exe。
例如:
cl / c / FA / Fa< outdir> \ a.cpp
cl / c / FA / Fa< outdir> \ subub \\ sub\b.cpp
当然,这可能看起来很烦人,因为每个目录都需要自己执行cl.exe。但是有一些方法可以使用通配符。
例如,/ Fa选项允许你指定一个目录,如果你有一个尾随\(因此我有< outdir> \或< outdir> \sub \)。这样做是因为它创建的文件与输出目录中的输入同名(当然使用正确的
扩展名)。
您还可以使用文件列表并且应该能够使用通配符进行输入。因此,您可以使用以下命令对目录中的选定文件执行此操作:
cl / c / FA / Fa< outdir> \sub\ sub \b1.cpp sub \b2。使用
cl / c / FA / Fa ; outdir> \sub\ sub \ * .cpp
据我所知,编译器无法自动为您执行此操作。我不确定最近是否有变化,但它甚至没有为你创建输出目录。当你看到这种情况发生时,它实际上是为你做这些事情的Visual Studio构建
系统(msbuild)。
hello everyone.
When i use cl for cpp files, it generates the files in the pwd. I am using the /Fa parameter (i need the asm file).
There is a way that it will generate the files in the same path of the files(even if i have multiple files in sub directories)
for example: for file a.cpp i want a.asm for sub\b.cpp -> sub\b.asm etc.
thanks in advance
yoni
The only way that I know is by using multiple runs of cl.exe.
For example:
cl /c /FA /Fa<outdir>\ a.cpp
cl /c /FA /Fa<outdir>\sub\ sub\b.cpp
Of course, this may look annoying, because each directory will need its own execution of cl.exe. But there are ways to use wildcards.
For example, the /Fa option allows you to specify a directory if you have a trailing \ (hence why I had <outdir>\ or <outdir>\sub\). What this does is that it creates files with the same name as the input in the output directory (with the correct extension of course).
You can also use lists of files and should be able to use wildcards for input. So you can do this to selected files in a directory using:
cl /c /FA /Fa<outdir>\sub\ sub\b1.cpp sub\b2.cpp sub\b3.cpp
and should be able to compile all .cpp files in a directory using
cl /c /FA /Fa<outdir>\sub\ sub\*.cpp
As far as I know, there is no way for the compiler to automatically do this for you. I'm not sure if something has changed recently, but it didn't even create the output directories for you. When you see this happen, it is actually the Visual Studio build system (msbuild) doing these things for you.
这篇关于CL的输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!