用VS2008编写了一个DLL工程,打算加上application进行调试,结果点下F5,DLL工程中的所有断点都被禁掉了,显示如下:
The breakpoint will not currently be hit. No symbols have been loaded for this document.
在网上搜了一下有没有找到合适的结果,自己瞎折腾倒是折腾出来了,再搜,找到了合适的结果,总结如下:
原因
DLL工程中的 pdb 文件的时间戳与application路径下的dll文件的时间戳 不一致。即当DLL工程新编译后,没有将工程下的新编译的dll文件拷贝至 application路径下,使得 application路径下的dll文件仍然为旧的。
解决办法
1. 将application exe拷贝至DLL功能debug目录下,这样就不会发生上述情况。
或
2. 在每次新编译dll后及时更新 application路径下的dll文件。
顺带附上在网上找到的一个英文解决办法,没看太懂,是C#,不过道理估计是相通的。
two projects, the first one (A) calls the second (B) as a .dll .Both are projects for PocketPC (Smart device applications).
When i set a Breakpoint in the code of B it looks OK but when i Debug Question Mark appears with the infamous
note: The Breakpoint will not currently be hit. No Symbols have been loaded for this document.
The B.pdb has a timestamp different from B.dll and THIS is the problem. You have to DELETE B.pdb NOT ONLY from the Debug/bin directory because THERE IS ANOTHER COPY of this B.pdb in the obj directory and you CAN'T touch this copy so easily. So here is the complete walkthrough:
1) For your project set "Generate DEBUG information" to FALSE
2) DELETE ALL the occurences of B.pdb under /bin and /obj
3) Set "Generate DEBUG information" back to TRUE
4) BUILD
Between 2 and 3 I also built once but i think this is not necessary.
Now my pdb and dll have the same timestamp and all is working perfectly