我在 Visual Studio 2010 中有两个项目,我想共享预编译的头文件输出 .pch(i) 文件:一个构建它,另一个应该只使用它。
在清理和重建 Project1 之后,将创建 .pchi 文件。
Rebuild Project2 做了一件奇怪的事情,它删除了 .pchi 文件,然后抱怨找不到它进行编译。
我应该改变什么来停止这种行为(可能在文件“Microsoft.Cpp.x64.Intel C++ Compiler XE 12.0.targets”中?)?
我已将文件设置为只读,然后 Project2 Build 当然会抱怨:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\Intel C++ Compiler XE 12.1\Microsoft.Cpp.x64.Intel C++ Compiler XE 12.1.targets(84,5):错误 MSB3061:无法删除文件“ .pchi”。拒绝访问路径“ .pchi”。
在第 84 行,.targets 文件有
< 删除条件="'%(ClCompile.DebugInformationFormat)' != '' and '%(ClCompile.DebugInformationFormat)' != 'OldStyle' and '%(ClCompile.ProgramDataBaseFileName)' != '' and !Exists(%( ClCompile.ProgramDataBaseFileName)) 和 '%(ClCompile.UseMSVC)'!='true' 和 '%(ClCompile.InterproceduralOptimization)'!='MultiFile' 和 '%(ClCompile.LevelOfStaticAnalysis)'!='Brief' 和 '% (ClCompile.LevelOfStaticAnalysis)'!='Medium' 和 '%(ClCompile.LevelOfStaticAnalysis)'!='Verbose'" Files="%(ClCompile.PrecompiledHeaderOutputFile)i" />