C++ 为什么我会收到错误 C1033:无法在 VS 2010 中打开程序数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20340200/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why do I get the error C1033: cannot open program database in VS 2010
提问by costa
After a long break from C++, I am trying to compile a very simple C++ project in VS2010. I created a Win32 C++ console empty project, I selected No precompiled headers and no other MS libraries. I added the following main.cpp file:
在与 C++ 长时间休息后,我尝试在 VS2010 中编译一个非常简单的 C++ 项目。我创建了一个 Win32 C++ 控制台空项目,我选择了 No precompiled headers 和没有其他 MS 库。我添加了以下 main.cpp 文件:
#include <iostream>
#include <string>
using namespace std;
class A
{
public:
string name;
};
int main(int argc, char** argv)
{
return 0;
}
When I compile I get the infamous error:
当我编译时,我得到了臭名昭著的错误:
1>------ Build started: Project: TestGetline, Configuration: Debug Win32 ------
1> main.cpp
1>main.cpp : fatal error C1033: cannot open program database ''
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here are a some facts:
以下是一些事实:
I am running Windows 7 64 bit as VM with Desktop Parallels: Version 6.1.7601 Service Pack 1 Build 7601. The VM has the Shared Profile checked, which means that the Documents, Downloads etc. folders are shared between OSX & Windows 7.
VS 2010 version: Microsoft Visual Studio 2010, Version 10.0.40219.1 SP1Rel, Microsoft .NET Framework Version 4.0.30319 SP1Rel
The link that I am using to launch VS 2010 has the Run this program in compatibility mode for Windows XP (Service Pack 3) checked. The Run this program as an administrator is not checked.
I tried a few things suggested in other posts and none of them worked. I tried, for instance, to kill the mspdbsrv.exe (VS 2010 was closed), remove the debug directories by hand, and then recompile the project. I tried to change the Debug Information Format to C7 compatible but then I get another error (main.cpp : fatal error C1074: 'IDB' is illegal extension for PDB file:). I tried to run VS 2010 as administrator but the error is as stubborn as a bedbug. And yes, there was antivirus running while trying all this.
我将 Windows 7 64 位作为 VM 与 Desktop Parallels 运行:版本 6.1.7601 Service Pack 1 Build 7601。VM 已选中共享配置文件,这意味着文档、下载等文件夹在 OSX 和 Windows 7 之间共享。
VS 2010 版本:Microsoft Visual Studio 2010,版本 10.0.40219.1 SP1Rel,Microsoft .NET Framework 版本 4.0.30319 SP1Rel
我用来启动 VS 2010 的链接已选中在 Windows XP (Service Pack 3) 的兼容模式下运行此程序。未选中以管理员身份运行此程序。
我尝试了其他帖子中建议的一些方法,但都没有奏效。例如,我尝试杀死 mspdbsrv.exe(VS 2010 已关闭),手动删除调试目录,然后重新编译项目。我试图将调试信息格式更改为 C7 兼容,但随后出现另一个错误(main.cpp:致命错误 C1074:'IDB' 是 PDB 文件的非法扩展名:)。我试图以管理员身份运行 VS 2010,但错误就像臭虫一样顽固。是的,在尝试所有这些时,防病毒软件正在运行。
Any other ideas? One cannot help to wonder if there is anyone at all doing C++ development in VS 2010. Upgrading to VS 2012 or 2013 is not an option at this time.
还有其他想法吗?人们不禁怀疑是否有人在 VS 2010 中进行 C++ 开发。此时升级到 VS 2012 或 2013 不是一种选择。
Thanks
谢谢
Just an update, here is the output of the build task that fails from the compilation log file:
只是一个更新,这里是编译日志文件中失败的构建任务的输出:
1>Target "ClCompile" in file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets" from project "C:\projects\cpp\TestGetLine\TestGetline\TestGetline.vcxproj" (target "_ClCompile" depends on it):
Using "Delete" task from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Delete"
Done executing task "Delete".
Task "CL" skipped, due to false condition; ('%(ClCompile.PrecompiledHeader)' == 'Create' and '%(ClCompile.ExcludedFromBuild)'!='true') was evaluated as ('' == 'Create' and ''!='true').
Using "CL" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CL"
Forcing recompile of all source files due to missing PDB "Debug\vc100.pdb".
Environment Variables passed to tool:
VS_UNICODE_OUTPUT=1328
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
Tracking command:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\Tracker.exe /d C:\Windows\Microsoft.NET\Framework\v4.0.30319\FileTracker.dll /i C:\projects\cpp\TestGetLine\TestGetline\Debug /r C:\PROJECTS\CPP\TESTGETLINE\TESTGETLINE\MAIN.CPP /b MSBuildConsole_CancelEvent7f4b09d9e64d472facf5c417755b2cdd /c "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe" /c /Zi /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
main.cpp
1>main.cpp : fatal error C1033: cannot open program database ''
The command exited with code 2.
Done executing task "CL" -- FAILED.
1>Done building target "ClCompile" in project "TestGetline.vcxproj" -- FAILED.
1>Done Building Project "C:\projects\cpp\TestGetLine\TestGetline\TestGetline.vcxproj" (build target(s)) -- FAILED.
采纳答案by costa
I unchecked the 'Run this program in compatibility mode for Windows XP (Service Pack 3)' checkbox and it works now. Originally I played with the other options but not this one !
我取消选中“在 Windows XP (Service Pack 3) 的兼容模式下运行此程序”复选框,现在它可以工作了。最初我玩了其他选项,但不是这个!
回答by Leonardo Miquelutti
To solve this problem, I deleted the pdb file (after I backed it up), then builded it.
为了解决这个问题,我删除了pdb文件(备份后),然后构建它。
回答by tashage
I get this error all the time when I am running a project in my dropbox folder. It seems that dropbox is backing up the .pdb file at the time I'm trying to build.
当我在我的 Dropbox 文件夹中运行一个项目时,我总是收到这个错误。在我尝试构建时,dropbox 似乎正在备份 .pdb 文件。
Usually it works after one or two tries.
通常它会在一两次尝试后起作用。
回答by Cork333
I just ran into the problem and it was because of space issues on the drive. When I cleaned out the directory everything built fine.
我刚刚遇到了这个问题,这是因为驱动器上的空间问题。当我清理目录时,一切都很好。
[Edit] Space was a red herring. It works out that the problem is random. It seems that when building many files VS2010 does not free the vc100.pdb file quickly. We placed a 1 sec wait between successive compiles and that helped most people. Some had to increase the wait to 3 seconds. It seems MS fixed this problem in VS2012, so if you have the option to upgrade that probably best.
[编辑] 空间是一条红鲱鱼。结果证明问题是随机的。似乎在构建许多文件时 VS2010 不能快速释放 vc100.pdb 文件。我们在连续编译之间放置了 1 秒的等待时间,这对大多数人都有帮助。有些人不得不将等待时间增加到 3 秒。MS 似乎在 VS2012 中解决了这个问题,所以如果你可以选择升级那可能是最好的。
回答by Tejfol
Make sure you are not debugging while trying to build. That solved it for me.
确保在尝试构建时没有调试。那为我解决了。
回答by Akash das
I also had this proplem
我也有这个问题
filename.cpp: fatal error C1051: program database file, 'e:\a\b\c\d\filename.pdb
文件名.cpp:致命错误 C1051:程序数据库文件,'e:\a\b\c\d\filename.pdb
I have solved this problem by deleting filename.pdb
file and it works.
我已经通过删除filename.pdb
文件解决了这个问题并且它有效。
After deleting it will Automatic generate *.pdbfile by building and also call that file
删除后会自动生成*.pdb文件,并调用该文件
回答by Gasteizko
In some cases, in new Windows enviroments, the paths can be case sensitive, but cl.exe cannot use them, so you need to check it and change to case insensitive. The problem is described here in spanish:
在某些情况下,在新的 Windows 环境中,路径可以区分大小写,但 cl.exe 无法使用它们,因此您需要检查它并更改为不区分大小写。这里用西班牙语描述了这个问题:
回答by phosaw
I also unchecked the 'Run this program in compatibility mode for Windows XP (Service Pack 3)' checkbox and it really works now. Originally I played with the other options but not this one !
我还取消了“在 Windows XP (Service Pack 3) 的兼容模式下运行此程序”复选框,现在它真的可以工作了。最初我玩了其他选项,但不是这个!
回答by stuicidle
I ran into the same issue but in Visual Studio 2005. Cancelling a build before it had finished caused the file to become corrupt, deleting the .idb file then re-building fixed the issue.
我遇到了同样的问题,但在 Visual Studio 2005 中。在构建完成之前取消构建会导致文件损坏,删除 .idb 文件然后重新构建修复了该问题。
回答by Dev
I solved it by moving the project folder to another folder. Then the compiler did not complain about it.
我通过将项目文件夹移动到另一个文件夹来解决它。然后编译器没有抱怨它。