开发者

LNK1201 on Visual C++ 2003

开发者 https://www.devze.com 2023-03-21 19:08 出处:网络
I keep getting this error message as a result after every Debug run I have done on any of my projects in VS2003.

I keep getting this error message as a result after every Debug run I have done on any of my projects in VS2003. I have browsed around many forums and they all provide an answer that does not fit to the actual problem.

LINK : fatal error LNK1201: error writing to program database 'd:\Coding\Flyff\Projects\GUI System 20110721\Debug\GUI System 20110721.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

I'm using Windows 7 Ultimate x64 with Visual Studio 2003 .NET (service pack VS7.1sp1-KB918007-X86.exe).

What I have tried already:

  • Run in compatible mode for several other operative systems and service packs.
  • Set project folders write permission to full.
  • Run Visual Studio as Administrator.
  • Edited Debug Information Format to several other formats.

To reproduce this bug, you must have Windows 7 x64 (probably Ultimate). Visual Studio 2003 (with VS7.1sp1-KB918007-X86.exe update).

I have over 150 GB space so it has nothing to do with that.

Visual Studio simple locks the PDB file when debugging, and after debug it cannot unlock it.

You must also run a code piece that is running for a few seconds, such as this:

int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,     int nCmdShow )
{
    Sleep( 5000 );
    MessageBox( NULL, "Test", "", 0 );
    return 0;
}

Hope anyone have a solution, as I'm currently required to use this environment configuration.

Cheers,开发者_开发技巧 Nicco.


I have finally found a workaround solution for this problem that has been plaguing me for quite sometime:

1) Download and install LockHunter (free utility to unlock locked files):

http://lockhunter.com/download.htm

2) Add the install directory of LockHunter to your environment variable "path" to avoid annoying administrator privilege popups every time you run the utility. For me (using x64 version) it was:

"C:\Program Files\LockHunter"

3) Add the following pre-build event to your Visual Studio project that is experiencing the issue:

"LockHunter.exe /silent /unlock $(TargetDir)$(TargetName).pdb"


The only time I have encountered this issue with VS2003 is when it crashes during a debug session. Usually the problem can be remedied by restarting VS. If that doesn't work you have to restart the debugger service and in some cases Windows.

You can try adding the following to command line of the pre-build event

net stop "Machine Debug Manager"
net start "Machine Debug Manager"

Since either VS or the debug manager is keeping the file locked I fear this problem is caused by a much deeper issue. There is a good chance that either a problem exists in your VS installation or there is another service or application causing the debug manager and/or VS to behave badly.


I encounter this error with VS2010 and tried fixing it using methods suggested in forums but they never worked for me. At the end I exited VS2010 and restarted as Admin and that did the trick!


I have the same inssue with winXP SP3 and VS C++ 2010 Express, and i solved changing the MyProject folder Access Permissions, uncheking "read-only" and apply to all folders, subfolders and files.


Non of the above answer work in my case, But finally I found my Solution.

When scale of the project grows and size of the ".pdb" file exceed 300MB, the error accrued. I change debugging info properties in my project and successfully compile it. You just need to change "Debug information format" in your project to "C7 compatible (/Z7)" in the following path.

Configuration properties >> C/C++ >> General >> Debug Information Format


Had similar problem on Windows 10. This answer provides a solution using a tool called FreePDB.

0

精彩评论

暂无评论...
验证码 换一张
取 消