vs2010调试程序出现“Cannot find or open the PDB file”

项目中源程序编写好以后,
(一个简单的小程序)
#include
int main(void)
{
int age;
int day;

age = 24;
printf("tom is %d years old\n",age);
printf("tom has been on earth for %d days\n",age*365);
//getchar();

return 0;
}
直接点击启动调试或者按F5,出现以下提示:

“exercise3.exe”: 已加载“E:\C语言学习Primer Plus\第二章\exercise3\Debug\exercise3.exe”,已加载符号。
“exercise3.exe”: 已加载“C:\Windows\SysWOW64\ntdll.dll”,Cannot find or open the PDB file
“exercise3.exe”: 已加载“C:\Windows\SysWOW64\kernel32.dll”,Cannot find or open the PDB file
“exercise3.exe”: 已加载“C:\Windows\SysWOW64\KernelBase.dll”,Cannot find or open the PDB file
程序“[872] exercise3.exe: 本机”已退出,返回值为 0 (0x0)。

但是程序运行完了,主函数的返回值也为零,只是dos窗口一闪而过,并且提示以上消息。
上网查看原因,得知是程序输出的地方是Windows系统,而不是vs2010。所以调试的话需要调用系统的一些资源,要到microsoft官网上下载,这样每次调试都比较耗费时间(操作方法:Tools---Options---Debugging---Symbols, 将microsoft symbol servers 勾选上即可),因为每次调试会从官网下载符号服务文件吧。
解决办法,可以按control+F5直接运行,而且这样操作的话dos窗口就不会一闪而过了


关于这个问题,visual studio工作室的人有回答,参考下文:
Hello,
We apologize if these messages are confusing, but is there any functionality you are expecting that is not available in the debugger? The symbol files (.pdb's) that cannot be found are the symbol files for the Windows system .dll's, and the only reason that you would need these is if you are trying to obtain complete callstacks including the Windows components, or debug into the Windows system API's. If you need the symbols, they are available from the Microsoft Public Symbol servers by checking the "Microsoft Symbol Servers" box under symbol settings (Tools -> Options -> Debugging -> Symbols). 
However, as I mentioned, unless you are unable to debug something in Windows you are expecting to be able to, there is no need to ever load these .pdb files to debug your application, and enabling the symbol servers will slow down your debugging experience since you will be loading more data into the debugging and making a network call to the symbol server (this can be mitigated by enabling a symbol cache on the symbol dialogue).
Best Regards,
Visual Studio Debugger 

(资料参考百度知道文库和他人博客等,感谢前人的解答)

转载于:https://www.cnblogs.com/TomLily/p/5814588.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值