(Visual Studio)如果编译为项目,构建时间会更长,如果单独编译,则构建时间会更短

时间:2017-11-20 11:33:40

标签: c++ visual-studio build compilation

我有一个cpp文件,如果我只是右键单击并在Visual Studio上编译它需要大约10秒钟编译,但是在编译为项目时需要花费大量时间(这个cpp文件在20中是1)其他)。

单独编译:

1>------ Build started: Project: Xcp.Test.Boost, Configuration: Release x64 ------
1>  XcpOnEthernetDisconnectSendTest.cpp
1>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c1xx.dll)=5.196s
1>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=5.826s
1>

编译项目:

21>  XcpOnEthernetDisconnectSendTest.cpp
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c1xx.dll)=4.693s
21>  Generating Code...
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=5.204s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=6.736s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=4.203s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=2.118s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=1.980s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=1.711s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=1.547s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=2.327s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=2.410s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=5.140s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=4.439s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=5.175s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=6.389s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=3.393s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=2.289s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=0.341s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=2.098s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=1.083s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=0.399s
21>  time(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c2.dll)=0.006s

另外,我没有看到其他文件的多个编译时结果,但是对于这个特定的文件。有人可以解释一下吗?

0 个答案:

没有答案