(一个简单的小程序)
#include
int main(void)
{
int age;
int day;
age = 24;
printf("tom is %d years
old
",age);
printf("tom has been on earth for %d
days
",age*365);
//getchar();
return 0;
}
直接点击启动调试或者按F5,出现以下提示:
“exercise3.exe”: 已加载“E:C语言学习Primer
Plus第二章exercise3Debugexercise3.exe”,已加载符号。
“exercise3.exe”:
已加载“C:WindowsSysWOW64
tdll.dll”,Cannot find or open the PDB
file
“exercise3.exe”:
已加载“C:WindowsSysWOW64kernel32.dll”,Cannot find or open the PDB
file
“exercise3.exe”:
已加载“C:WindowsSysWOW64KernelBase.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,
Weapologize 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).
BestRegards,
VisualStudio Debugger
We
However,
Best
Visual
(资料参考百度知道文库和他人博客等,感谢前人的解答)