views:

1544

answers:

2

When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant be found with my library.lib. Apparently, as a result, the edit and continue feature of the IDE fails to work any project that incorporates library.lib

What magic is needed to tell VS2005 to produce a static lib with edit and continue debug info that does NOT reference or require vs80.pdb when linked into a project?

--Upon Further Understanding-- So, In order to get edit-and-continue to function with a pre-compiled static lib, we need to place the vs80.pdb and vs80.pdb file into SVN along with the .lib, AND rename the pdb/idb to prevent conflicts when doing this with multiple pre-compiled libs.

+2  A: 

vc80.pdb is the file that contains the debug information for your lib. In the ide Property pages:configuration properties:c\c++:output files allows you to rename this to something more appropriate, such as the name of your lib. When the linker links your lib into the target exe it looks for this pdb (there is a pointer to it in the lib) and extracts the info from that pdb and drops it in the exe's pdb.

/Fd[name] is the option for renaming the pdb /ZI is the option for compiling with a pdb that includes Edit and Continue information.

All linked libs and the final taget exe or dll need /ZI, to enable edit and continue.

I made a tiny testlib.lib and used "dumpbin /all" to get the following showing the pointer to the debug info (this is a tiny excerpt):

SECTION HEADER #7
.debug$T name
       0 physical address
       0 virtual address
      48 size of raw data
     838 file pointer to raw data (00000838 to 0000087F)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
42100040 flags
         Initialized Data
         Discardable
         1 byte align
         Read Only

RAW DATA #7
  00000000: 04 00 00 00 42 00 15 15 D5 EA 1E C9 7C 10 3A 40  ....B...Õê.É|.:@
  00000010: 93 63 CE 95 77 15 49 4A 03 00 00 00 64 3A 5C 64  .cÎ.w.IJ....d:\d
  00000020: 65 76 5C 74 65 73 74 5C 74 65 73 74 6C 69 62 5C  ev\test\testlib\
  00000030: 74 65 73 74 6C 69 62 5C 64 65 62 75 67 5C 76 63  testlib\debug\vc
  00000040: 38 30 2E 70 64 62 00 F1                          80.pdb.ñ
Steve Steiner
The thing I dont understand about this is there is a PDB specified in the compiler settings using /Fd[name] which defaults to vc80.pdb AND there is a pdb in the linker settings, which defaults to $(targetname).pdbI always need both pdbs?
Chris Becke
Yes, unfortunately the VC toolset's setttings seem like they are NP complete. http://sourceforge.net/projects/pdbdump has a tool for looking inside pdbs. That and dumpbin can help understand where debug information is flowing from through the toolchain.
Steve Steiner
A: 

If you can live without 'edit and continue', try using /Z7.
I use it for all the .lib files that are stored in source control. No .pdb file is created - the debug info is stored inside the .lib file.

george