Microsoft KB Archive/238875

= C2471 or LNK1140 errors may occur when you run into program database (PDB) file limits in Visual C++ =

Article ID: 238875

Article Last Modified on 5/26/2005

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q238875



SYMPTOMS
The following errors are normally related to running into the module and size limits when a program database (PDB) file is created (a PDB file contains information used by the debugger; the file has a .pdb extension):

Compiler Error:

C2471: cannot update program database

Linker Error:

LNK1140 "too many modules for program database; relink with /PDB:NONE"

Linker Error:

LNK1201: error writing to program database "c:\MSDEV\Projects\yourapp\Debug\yourapp.pdb"; check for insufficient disk space



CAUSE
There is a limit of 4096 modules (.obj files) in a PDB file. The file also has a total size limit of approximately 64 MB.



RESOLUTION
There are several ways to reduce the size of PDB files:
 * Build some of the source files with the /Zd switch (line numbers only).
 * Build some of the source files as separate dynamic-link libraries (DLLs) instead of static libraries.
 * Build some of the source files without debug information.
 * Try the compiler switch /Fd"myproject.pdb" (including the quotation marks).



MORE INFORMATION
Note that the linker option /PDBTYPE:SEPT may have little affect in reducing the project's PDB file size. In Visual C++ 5.0, if you choose to use the /Fd switch, avoid using the linker option /PDBTYPE:SEPT if the PDB file name you choose is the same under compiler and linker options.

