4

I have a Visual Studio c++ project where I use the linker Settings

/WX (TreatWarningsAsLinkerErrors=true)

In Debug, I compile with /Zi (Debug Database), which works fine.

Now I have a 3rd party SDK which comes with a static library, but no .pdb file. As soon as I link this file in Debug, I get

LNK4099: 3rd-party.lib(3rd-party.obj) : warning LNK4099: PDB "vc90.pdb" was not found "3rd-party.lib(3rd-party.obj)" or with "C:\OutDir\vc90.pdb"

Please note that this message is misleading, as placing vc90.pdb next to 3rd-party.lib does not solve the problem, because the source code and pdb of that 3rd-party lib is not available, so the linker would then still complain.

In order to get rid of this linker warning, what are my options here?

F. Schaaf
  • 83
  • 1
  • 7
  • 1
    /ignore:4099 indeed works. The downside is, I actually don't want LNK4099 to be suppressed completely, but this is better than nothing. – F. Schaaf Jun 22 '16 at 15:08
  • @Gibet: Please turn your comment into an answer. It's a good response and will help people in the future. They are more likely to find it if it is an answer. – Dale Wilson Jun 22 '16 at 15:19

1 Answers1

3

Easiest way if you use a VS post 2010 (so 2012/2013/2015) is to add the /ignore:4099 option to the linker. Should ignore this specific warning. Sure that before 2012 this warning was specifically ignored... It existed but was a kind of "yeah but we do not care" warning.

More complex way... If you have the "energy/motivation/advanced user courage/Visual studio 2010 or before [2008/VC6/...]" You can actually extract the symbols used during linking using the lib command lib /list obj.lib. You will obtain a lit of the obj included in the lib, that you can extract with the lib /extact ../path/to/my/obj command. THEN you have to extract the debug section using the dumpbin /section:.debug$ And there you will find the pdb problem... using /fd command you can relink correctly the pdb. It is somehow a lot of work. This is the short summary of what you can find here : https://cldoten.wordpress.com/2009/07/01/vs2008-fixing-the-warning-pdb-vc90-pdb-not-found/ Follow the link I gave carefully.

Obviously the ignore method is probably the easiest and less problematic, especially if you use a lot of third-party libraries.

  • I accept this answer, because /ignore:4099 worked. I didn't test extracting the symbols, and I'm not sure if this is fixable when I don't have the pdb. It might still be worth a try. – F. Schaaf Jun 22 '16 at 15:45
  • I have this issue using VS2019. I am getting LNK4099 on the x64 build and LNK4204 on the Win32 build. Have added /ignore:4099 and /ignore:4204 in the Additional Options in the Linker:Command Line section but am still getting the warning – JonN Dec 24 '19 at 02:59
  • @JonN - Silly question, but did you make sure you had **Configuration** and **Platform** set correctly when you made the change in the Property Pages? For some reason, those two aren't set to my current build settings by default when that dialog comes up, and it's an easy thing to miss... – Scott Smith Oct 18 '21 at 22:19
  • Looking back at my build options the ignore 4204 is definitely on the Win32 debug config platform. However even though my preference was to use the static library I gave up on that and replaced it with the equivalent DLL which has no such warning. :) – JonN Oct 20 '21 at 21:35