Including .pdb files with librarian in Visual Studio
The static library has probably been moved, so the compiler can't find the symbols from it. You have several options:
- change debugging format to
/Z7
, which embeds the debug info in the code (whereas/Zi
and/ZI
put it in a separate file). - change the output configuration of the pdb file (for VS2005 it was
Settings > C++ > Output Files > Program Database File Name
, probably similar in VS2010).
You can find more information here and here.
JBentley
Updated on June 04, 2022Comments
-
JBentley almost 2 years
I have a project whose output is a library (.lib). The project depends on a third party library (also a .lib). In order to avoid projects built on top of my library having to worry about this third party dependency, I have used the librarian to include it in mine (Project Properties > Librarian > General > Additional Dependencies).
However, when I build a separate executable project which links to my library, I get a bunch of warnings along the lines of:
MyProject.lib(someThirdPartyObjectFile.obj) : warning LNK4099: PDB 'vc110.pdb' was not found with 'MyProject.lib(someThirdPartyObjectFile.obj)' or at '\vc110.pdb'; linking object as if no debug info
This means (I assume) that I will be able to debug any code belonging to my library, but not to the third party library.
How can I instruct Visual Studio to also include the contents of the third party library's PDB in mine?
-
Synxis over 11 yearsYou can still debug without
pdb
file, but it will be without debug info (function names, etc...). I had this warning once, but it was without consequences (and I do not remember how I fixed it). Was with VS2008, though. Maybe you can try to build and debug, to see if the debug info is really used. Last: static or dynamic lib ? -
JBentley over 11 years@Synxis I intend to, I just haven't had a chance to try out the proposed solutions yet. I will do that soon.
-
Pedro Reis over 8 yearsPossible duplicate of PDB 'vc100.pdb' was not found with
-
-
JBentley about 10 yearsThanks, I revisited this problem and from your answer worked out what the problem is. Visual Studio by default places the PDB file in the Intermediate folder instead of the Output folder, and so my third party library's PDB couldn't be found when I was linking to it. Changing the setting you mentioned from
$(IntDir)vc$(PlatformToolsetVersion).pdb
to$(OutDir)vc$(PlatformToolsetVersion).pdb
ensures that the PDB is placed in the same folder as the .lib output. I have no idea why Visual Studio doesn't default to this, as placing the PDB in the intermediate folder makes no sense to me. -
anatolyg over 9 yearsWhy? Also, can it have negative side-effects?