0

I use PDB files built with "Program Database for Edit And Continue (/ZI)" for Debug builds, which generates PDB files, as I want to be able to step into source of libraries I'm using in a project when debugging the project. When using DLLs with PDB files, according to MSDN, the compiler looks for the PDB files in the folder where the DLL (or EXE) files are. But I also have components that are static LIBs rather than shared. I usually set the compiler to generate PDB files named with the project, rather than the platform (the latter being the default) so I can move them around without filename conflicts. But where should I put these PDB files from the static LIBs? Do I put them in the same folder as the LIBs are? I keep my built LIBs in a different folder than the executables, as I have a folder hierarchy something like \bin \include \lib \data.

Display Name
  • 2,323
  • 1
  • 26
  • 45
  • That's not how it works. The pdb for a static lib is used by the linker to create the pdb for the executable file. You no longer need it. It is very unclear what problem you are trying to solve. – Hans Passant Oct 04 '13 at 20:00
  • I have a collection of libraries I've built, some of them static, some of them shared DLLs. When I'm building an executable in a given project, the compiler needs to know where to find the PDB files for both the DLLs and the static LIBs. I keep all project trunk DLLs and the executables in a /bin folder, and the compiler can find the PDBs for the DLLs there fine. I keep all the import LIBs and all the static LIBs in a /libs folder--but where do I put the PDB files of the static LIBs so the compiler can find them as well? – Display Name Oct 04 '13 at 23:15
  • That's the part that makes no sense at all. The compiler doesn't use pdbs, it creates them. The linker combines them to create the final one that the debugger uses. You haven't yet explained what actually goes wrong. Post an error message or a specific mishap when you debug, anything else sounds like fretting over a problem you don't actually have. – Hans Passant Oct 04 '13 at 23:38
  • I'm not able to step into source of static libraries that I'm linking to unless their corresponding projects are opened in Visual Studio (possibly other instances of VS), and even though they're built with the full debug settings. – Display Name Oct 17 '13 at 21:41

1 Answers1

0

You should copy the PDBs to the same location as the LIBs they are associated with. When the linker is run to produce a DLL or EXE from the LIB, it will use the LIB PDB to produce the PDB for the DLL or EXE.

You can use Post-Build Event to add command-line operations to copy the LIBs/PDBs around after each build.

Kent
  • 1,691
  • 4
  • 19
  • 27