使用VS2008在一個解決方案中包含多個項目時,當設置多個項目的中間目錄爲同一個目錄時,在增量編譯時出現「從新編譯時vc90.pdb不是建立此預編譯頭時使用的pdb文件,請從新建立預編譯頭問題」,從而致使整個解決方案每次都必須從新所有生成。ide
在msdn上得到以下信息:ui
You may receive a "PRJ0008" or "C2471" or "C1083" or "D8022" or "LNK1103" or similar error message when you try to build a solution in Visual C++ debug
Symptoms: orm
- D8022 : Cannot open 'RSP00000215921192.rsp'
- PRJ0008 : Could not delete file 'vc90.idb'.
- C1083 : Cannot open program database file 'vc90.pdb'
- C2471 : Cannot update program database 'vc90.pdb'
- LNK1103 : debugging information corrupt.
Cause: three
This problem occurs when all of the following conditions are true: ip
- You have a solution with more than one project in it.
- Two or more of the projects are not dependent on each other.
- You have parallel builds enabled. (Tools -> Options: Projects and Solutions, Build and Run: "maximum number of parallel project builds" is set to a value greater than 1)
- You are building on a system with multiple CPUs (cores).
- Two or more of the non-dependent projects are configured to use the same Intermediate and/or Output directory.
- A specific race condition in mspdbsrv.exe remains uncorrected.
Resolution: ci
To resolve the problem do one or more of the following: rem
- Reconfigure the non-dependent projects to specify an Intermediate and Output directory that is different from one another, e.g. Output Directory = "$(SolutionDir)$(ProjectName)\$(ConfigurationName)", Intermediate Directory = "$(OutDir)".
- Adjust your solution's project dependencies (Project -> Project Dependencies...) so that each is dependent on another.
- Disable parallel builds.
- Add the "/onecpu" boot option to your boot.ini file.
- Change you BIOS settings to enable/use only one CPU.
- File a problem report with Microsoft Technical Support and keep bugging the ____ out of them until they eventually fix mspdbsrv.
Status: get
The problem is a combination of both a user project configuration error as well as a race condition in Microsoft's "mspdbsrv.exe" utility that does not properly handle more than one thread calling it at the same time for the same file resulting in the file's HANDLE being left open. it
Additionally Visual Studio itself and/or its build system (VCBUILD and/or MSBUILD) (or all three!) should be made smart enough to detect and alert the user of such user errors so that corrective action can be taken.
This problem has been around for a LOOOOOONG time.
Applies to:
- Microsoft Visual C++ 2005
- Microsoft Visual C++ 2008
- Others?
Respectfully submitted:
"Fish" (David B. Trout)
fish@infidels.org
p.s:
You're welcome. :)
Fish (David B. Trout)
最後,經過從新配置項目的中間輸出目錄成功解決上述問題。
遺留問題:在每一個項目生成時,在對應的中間目錄下都會生成vc90.pdb以及vc90.idb文件,若是所有項目的中間目錄配置成相同目錄,在項目依次生成過程當中,後面生成的pdb文件會覆蓋前面生成的pdb文件,從而致使修改部分源代碼時,pdb文件可能再也不是其對應項目生成的文件,所以須要從新生成整個解決方案。純屬猜想,後續能夠使用逐步生成項目的方式驗證結論。
https://social.msdn.microsoft.com/Forums/vstudio/en-US/25731965-bf98-4bb7-97b7-6d1a0b21b733/cant-open-vc90pdb-in-visual-c-2008-rebuild?forum=vcgeneral