开发者

Printing the whole command used by Visual Studio to compile a file

When we compile a C/C++ project in Visual Studio, the output window just prints the name of the file being compiled. How do we print the whole command? I.e., all the include directories, flags, etc. being used in compiling that file?

I know there is an option when we right click on a file name, PropertiesCommand line, which shows the c开发者_C百科ommand to be used while building, but I want it to get printed on the output window.


You can see command line switches in BuildLog.htm file produced by Visual Studio. Use Ctrl+Click in the Output window link to see this file after building a project.

Also, reading this file, we can see that printing full command line in Output window will not help:

Creating temporary file "c:\tmp\test\Debug\RSP00000125403116.rsp" with contents
[
/Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug\test.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /Wp64 /ZI /TP .\test.cpp
]
Creating command line "cl.exe @c:\tmp\test\Debug\RSP00000125403116.rsp /nologo /errorReport:prompt"

So, Visual Studio creates temporary file with command line switches, and command line contains this file name.

Update for new Visual Studio versions. Tools - Options - Project and Solutions - Build and Run. MSBuild project build output verbosity. Select Detailed or Diagnostic to see more information in the build log (Output window).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜