Solved

How to avoid LNK1201 Error Writing to Program Database?

Posted on 2003-11-04
4
2,645 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

759 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now