问题
When building a static library (.LIB
) in MS Visual Studio 10 with debug information,
the .PDB
is always named vc100.pdb
.
(as opposed to building a .DLL
, where the debug info is [MyProjectName].pdb
)
This is a problem for me because I'm trying to copy several different libraries (and their debug symbols) to a directory of "PublishedLibraries"
, but all the vc100.pdb
names obviously collide.
I'm sure I can change the names of each .PDB
to match its .LIB
, but for me the bigger question is why does Visual Studio think vc100.pdb
is a better name than projectA.pdb
??
How are we intended to work with Debug Info from multiple libraries if all the names conflict?
回答1:
If you use /Z7 (instead of /ZI or /Zi) [ in the UI C/C++ -> General -> Debug Information Format] then the debug information is embedded in the lib file itself, instead of a separate pdb, which means you don't need to worry about the same name.
When you build your final executable (.exe or .dll) then you'll get a merged pdb from all the little embedded pdbs.
see this question for more info
Its the way I've always managed this issue on my team, as you can't lose the debug information during the build process. It bloats the libs somewhat [but no more in total than having both lib and pdb], but as you probably don't ship libs you shouldn't worry to much about this.
来源:https://stackoverflow.com/questions/17052406/pdb-files-with-libraries-in-visual-studio-10