0

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?

leppie
  • 115,091
  • 17
  • 196
  • 297
gil_mo
  • 575
  • 1
  • 6
  • 27

1 Answers1

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

gil_mo
  • 575
  • 1
  • 6
  • 27
xMRi
  • 14,982
  • 3
  • 26
  • 59