How to link using an external pdb?

不想你离开。 提交于 2020-01-07 02:15:34

问题


In VS2012, I'm statically linking with a precompiled .lib, and need to also use that lib's .pdb file for debugging. How can I tell the linker that it should use that external pdb file?


回答1:


If you created the static lib with /ZI or /Zi (see project settings for C/C++ -> General -> Debug Information Format), then the $(IntDir)vc$(PlatformToolsetVersion).pdb file is created. The path is defined by /Fd.

A linker that uses the static library usually also refers to this pdb file. If you link an executable with the static lib and the linker can't find the pdb file you should get the error like this

LNK4099: PDB 'vc1xx.pdb' was not found with 'foo.lib(foo.obj)

So what you want is the default. You may turn on verbose linking to see what happens to your symbols.

Microsoft always ships a PDB file with their static libraries named the same way like the static lib. So you find a libcmt.lib and a libcmt.pdb



来源:https://stackoverflow.com/questions/27518920/how-to-link-using-an-external-pdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!