I built a 3rd party static library in a folder called <libraryBuildDir>
and copied the resulting *.lib file into my projects folder structure. Along with the *.lib, I also placed the *.pdb file. Then I deleted <libraryBuildDir>
, assuming it's no longer needed. This is what worked for other libraries before and it follows what seems to be a common practice.
However, when I build my project in debug configuration I get many LNK4099 warnings like this (roughly translated):
<myLib>.lib(<someObjFromTheLib>.obj) : warning LNK4099: PDB "<myLib>.pdb" was not found alongside "<myLib.lib>" or "<myBuildDir>". Linking without debug info
I verified that the *.pdb file is there right next to the *.lib file. As a test, I placed it right into the build directory, as suggested by the warning. Now I get many LNK4204 like this:
<myLib>.lib(<someObjFromTheLib>.obj) : warning LNK4204: "<myBuildDir>\<myLib>.pdb" is missing debugging information for referencing module; linking object as if no debug info
I followed this advice to extract one of the object files that appeard in my warnings, (<someObjFromTheLib>.obj
). I noticed that the extracted *.obj file did not contain a Debug$T
section.
So apparently when I copied the *.pdb file from <libraryBuildDir>
to my project, I broke some links to other debug symbol files that are now not available anymore, because I deleted <libraryBuildDir>
. This makes me think that my whole process is wrong.
My goal: Compile the static library with debug symbols and move the finished *lib file to another project. Then compile the other project and include the full debug symbols from the static library.
How can I move a pdb file from a temporary library build directory to another directory without breaking any references?
(Sidenote: I'm compiling Crypto++ v8.2.0 using cmake and the *.pdb file is called cryptopp-object.pdb
whereas the library is called cryptopp-static.lib
. This goes against the convention that *.lib and *.pdb have the same name, but it is how Crypto++ is configured and I don't want to change that if possible. However, the *.lib file seems to expect the correct name for its pdb file so I assume that this is fine.)
(Also: lib /list <myLib>.lib
lists a lot of *.obj files and only some of those appear in my LNK4099 warnings, whereas others don't. I don't know if that means they're simply not used in my project or if they have all debug information available.)