Search code examples
c++visual-studiodebuggingdllstatic-libraries

VS2015 "no symbols loaded for this document" for .lib file


I have an issue where I have a .dll file that is compiled in debug. It statically links with a .lib file, which is also compiled in debug. The source is available for all of them. However when I run the .dll and attach VS to the process it can only step through the .dll's own function but not the ones in the .lib.

In the module view I can see that symbols are loaded for all the modules. How can ensure that .lib has symbols associated with it as well? As I understand because it is linked statically the symbols for it should be generated when compiling the "parent" .dll, is that correct? So is there something I need to do when building the .dll to make sure that ALL functions can be stepped through?


Solution

  • You need to add the location of the pdb file of the LIB you just built for the debugger to find the symbols in the appropriate Tools/Options section (usually the same directory as the output LIB).

    Enter your .pdb file path in here

    Then, you can add the location of the source files in the according Solution Property page :

    Place the directory for source files here

    Then, Visual Studio debugger will find all appropriate information. It will load symbols and be able to jump into the LIB source code when appropriate.