Compilation fails randomly: "cannot open program database"

Lev picture Lev · Sep 24, 2008 · Viewed 42.1k times · Source

During a long compilation with Visual Studio 2005 (version 8.0.50727.762), I sometimes get the following error in several files in some project:

fatal error C1033: cannot open program database 'v:\temp\apprtctest\win32\release\vc80.pdb'

(The file mentioned is either vc80.pdb or vc80.idb in the project's temp dir.)

The next build of the same project succeeds. There is no other Visual Studio open that might access the same files.

This is a serious problem because it makes nightly compilation impossible.

Answer

SCFrench picture SCFrench · Sep 24, 2008

We've seen this a lot at my site too. This explanation, from Peter Kaufmann, seems to be the most plausible based on our setup:

When building a solution in Visual Studio 2005, you get errors like fatal error C1033: cannot open program database 'xxx\debug\vc80.pdb'. However, when running the build for a second time, it usually succeeds.

Reason: It's possible that two projects in the solution are writing their outputs to the same directory (e.g. 'xxx\debug'). If the maximum number of parallel project builds setting in Tools - Options, Projects and Solutions - Bild and Run is set to a value greater than 1, this means that two compiler threads could be trying to access the same files simultaneously, resulting in a file sharing conflict. Solution: Check your project's settings and make sure no two projects are using the same directory for output, target or any kind of intermediate files. Or set the maximum number of parallel project builds setting to 1 for a quick workaround. I experienced this very problem while using the VS project files that came with the CLAPACK library. UPDATE: There is a chance that Tortoise SVN accesses 'vc80.pdb', even if the file is not under versioning control, which could also result in the error described above (thanks to Liana for reporting this). However, I cannot confirm this, as I couldn't reproduce the problem after making sure different output directories are used for all projects.