Solved

How to avoid LNK1201 Error Writing to Program Database?

Posted on 2003-11-04
4
2,721 Views
Last Modified: 2013-12-03
I have a very large application built in MSDEV 6.0.
I seemed to have approached a size limit for the .pdb file.
(It is around 64M.)
I get the LNK1201 error every other time I build the app.
I have several Gig of available disk space, so that's not the issue.
Removing the existing .pdb seems to allow it to build.
Rebuilding the .pdb from scratch each time seems to fix it,
but it unfortunately takes a long time to link the app.
I started removing debug symbols from the app using the
/Zd compiler flag.

Can anybody confirm that this size limit exists in VC60?
Is it the same in 7.0?
Do you know of any better workarounds for this problem?

Also, strangely enough, a fellow developer here builds the same
exact app on a different machine, but has a much smaller .pdb file.
He has the same version of compiler & linker that I do.
What can explain this difference?

Thanks.
0
Comment
Question by:bwilhelm
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 9679652
>>I seemed to have approached a size limit for the .pdb file.

Indeed - see http://support.microsoft.com/default.aspx?scid=kb;en-us;238875 ("PRB: C2471 or LNK1140 Error with PDB File Limits")

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


>>Is it the same in 7.0?

The article states:

The information in this article applies to:
Microsoft Visual C++, 32-bit Enterprise Edition 5.0
Microsoft Visual C++, 32-bit Enterprise Edition 6.0
Microsoft Visual C++, 32-bit Professional Edition 5.0
Microsoft Visual C++, 32-bit Professional Edition 6.0
Microsoft Visual C++, 32-bit Learning Edition 6.0


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).
0
 
LVL 86

Expert Comment

by:jkr
ID: 10801416
I'd say the Q is answered...
0
 

Expert Comment

by:haggersr
ID: 25955339
This doesn't resolve the issue. It still exists in 2009. vs7.1 and 8.0 still has this issue. MS needs to fix their IDE software (C++).
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question