2012年5月31日 星期四

VS2010 --- Cannot find or open the PDB file ?!

用了VS 2010 會產生 "Cannot find or open the PDB file " 訊息...

查了一下網路上的解答,最後得到一個算是來自原廠的回答:

看來也是一位老中小姐吧:Helen Zhao ?!

---

最後還不免促銷一下新版的 VS11....天啊...還真的還要出新版的啊!

----

專業回答:

http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/24b25003-b37b-4e08-be4d-5a23fa6e482b

The message "Cannot find or open the PDB file" is something you don't have to worry about. If you notice all of the files that this applies to are Windows' system DLLs and other DLLs from third party components. Any problems you are getting are not a result of this message since normally you run programs without these PDB files and they mostly run OK.

So what is a PDB file, well it is a file which contains things like function names and associates them with addresses in an executable and also lines of code in a source file. If you look at the very first one in the list, your application executable, it has "Symbols Loaded" next to it. If you press f10 to start your application, notice how it goes to the first line in your main function? This is thanks to the PDB file, if you press f10 again, notice how it just steps to the next line of code? This is thanks to the PDB file. Giving you source level debugging and giving you symbols so you can get an accurate call stack is really all PDB files do.

If you want to get rid of most of these messages you can get debugging symbols for most of these DLLs, but it won't give you access to the Windows source. If you go to Tools->Options and in the window that appears go to Debugging->Symbols and check Microsoft Symbol Server and in the Cache symbols in this directory text box below, enter a path to an empty directory where you want to cache these symbols. Be warned that this can get big and the first time one of these loads there can be a pause because it will have to download from the internet. If you do this right, most of the "Cannot find or open the PDB file" will change to "Symbols loaded (source information stripped)".

As you probably would have guessed from the tone of this post though, this won't fix your current crashes.


This is a signature

Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Do you want Visual Studio 11 Express to be freely installable on Windows 7 and able to write regular C++ applications? Please vote for this.

4 則留言:

  1. 看來你真的很不熟 VC 啊,這隨便找個對 VC / C++ 較有了解的人應該就問出來了 :)

    回覆刪除
    回覆
    1. 謝謝您的意見喔!...
      要把VC 許多問題搞得清楚的,我相信也不是一天兩天可以辦得到的。
      所以,搞軟體當然是一門專門的知識與技能。
      但會又說回來,在我們這些搞系統應用中,有時又要寫韌體,又弄點
      硬體的...大家可以想一想:搞硬體,寫韌體和弄清楚VC 的~
      您覺得人家老闆會比較喜歡哪一種的工程師呢?
      至少以我來說:這三者之間,我是不太會花太多心思在VC 的啦!

      :)) ... :)) ... :)) ...  雖然我也知道軟體很重要的啦! :)) ... :)) ... :)) ... 

      刪除
  2. 的確就是各有不同的專業,所以我才說找個熟 VC 的人問一下就好了,這樣比較不浪費時間。
    至於老闆喜歡哪種人呢? 搞硬體的、韌體和弄清楚VC 的? 應該代換成:搞硬體的、寫軟體的(韌體其實也是軟體,而應該也沒人只弄清楚 VC 而不懂軟體的)。那到底軟硬體的人誰比較重要? 這種答案該怎麼答應該很簡單吧,完全看公司的需求和定位囉...

    回覆刪除
    回覆
    1. 現在有一種東西叫做:Google 。
      您要我去問熟VC 的人?!現在搞VC 軟體的人都一副有「被迫害妄想症」
      似的。...對別人提出的問題,總是擔心受怕似的...更何況有時真的很怕
      看別人的程式的...所以問了幾次之後,也不太想造成別人「病情」惡化。
      所以才有這一篇文章啊,還是自己Google 一下比較快吧!
      ....
      至於那一種偏好專長,也不一定是看公司需求與定位...有時連一個
      小主管我們也未必搞得定,...就連一樣搞系統應用,官大學問大...
      哪需要還要管您做什麼?!...自己Happy 一點比較重要吧!

      刪除