127

I'm using a library from CGAL which during the linking stage of my code compilation produces a lot of linking warnings of this form:

warning LNK4099: PDB 'vc80.pdb' was not found with 'gmp-vc80-mt-sgd.lib' or at 'vc80.pdb'; linking object as if no debug info

How do I turn off this specific linker warning under Visual C++/Studio 2008?

Note that I do not have any control on the external (CGAL) library which I am using. I cannot/donot want to get into recompiling the external library. Hence, the need to fix the messages at my end.

Ashwin Nanjappa
  • 68,458
  • 72
  • 198
  • 283

8 Answers8

107

Add the following as a additional linker option:

 /ignore:4099

This is in Properties->Linker->Command Line

nneonneo
  • 154,210
  • 32
  • 267
  • 343
Aaron Saarela
  • 3,706
  • 1
  • 17
  • 17
  • 5
    I don't think /ignore exists. The errors are still listed, and /ignore is not documented in MSDN. I'm trying to disable 4075 for "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification." – Nick Desjardins Mar 01 '10 at 21:00
  • 1
    /IGNORE is not documented but is available. See http://connect.microsoft.com/VisualStudio/feedback/details/176188/can-not-disable-warning-lnk4099 – Aaron Saarela May 12 '11 at 17:14
  • /ignore does not seem to work for Windows CE (SH4) target under Visual Studio 2008. – akauppi Oct 20 '11 at 12:34
  • 5
    Doesn't work for warning 4099 http://connect.microsoft.com/VisualStudio/feedback/details/176188/can-not-disable-warning-lnk4099 – KindDragon Dec 21 '11 at 11:53
  • 8
    You can use /ignore:4099 as a linker flag, but there's a catch. Unfortunately, Microsoft decided to make 4099 a non-ignorable warning, so you have to patch the link.exe. Sounds kinda crazy, but there's simply no other way. More details here: http://www.bottledlight.com/docs/lnk4099.html I used HxD as a hex editor, and following the description on that page worked fine with VS10. The order is still 4088, 4099, 4105. – Andreas Haferburg Feb 13 '12 at 14:59
  • bottledlight.com was a 404 for me as well, but there's [this bitsquid blog](http://bitsquid.blogspot.com/2011/12/code-share-patch-linkexe-to-ignore.html) posted in late 2011. The provided ruby code enumerates all the link.exe versions, makes backups, and does a simple find replace. It replaces `[4088, 4099, 4105]` with `[4088, 65535, 4105]`. – Millie Smith Jan 08 '16 at 17:49
  • Also this. http://michaelnoland.com/how-to-supress-warning-lnk4099-pdb-xxx-was-not-found/ – Millie Smith Jan 08 '16 at 18:31
  • `/ignore:4099` doesn't seem to work on VS12 update 3 – Millie Smith Jan 13 '16 at 15:45
  • 2
    Works on VS 2015 (the project is using VS2013 toolset, not sure if that makes a difference) – Assimilater May 27 '16 at 16:08
50

Update 2018-10-16

Reportedly, as of VS 2013, this warning can be disabled. See the comment by @Mark Ransom.

Original Answer

You can't disable that specific warning.

According to Geoff Chappell the 4099 warning is treated as though it's too important to ignore, even by using in conjunction with /wx (which would treat warnings as errors and ignore the specified warning in other situations)

Here is the relevant text from the link:

Not Quite Unignorable Warnings

For some warning numbers, specification in a /ignore option is accepted but not necessarily acted upon. Should the warning occur while the /wx option is not active, then the warning message is still displayed, but if the /wx option is active, then the warning is ignored. It is as if the warning is thought important enough to override an attempt at ignoring it, but not if the user has put too high a price on unignored warnings.

The following warning numbers are affected:

4200, 4203, 4204, 4205, 4206, 4207, 4208, 4209, 4219, 4231 and 4237
John Weldon
  • 37,037
  • 10
  • 91
  • 126
  • He does not say "the 4099 warning is too important to ignore"; he infers this from the fact that it can't be turned off. (Noted here since there's zero extra information at that link.) – Ben M Dec 07 '12 at 21:14
  • Updated to address your concern @BenM – John Weldon Dec 07 '12 at 22:41
  • 1
    This answer is **old**, disabling warning 4099 worked fine for me on VS2017. It appears from comments here that it can be disabled probably starting with VS2013. – Mark Ransom Oct 16 '18 at 20:26
10

(For the record and before the thread disappears on the msdn forums) You can't disable the warning (at least under VS2010) because it is on the list of the warnings that can't be disabled (so /wd4099 will not work), but what you can do instead is patch link.exe (usually C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe) to remove it from said list . Sounds like a jackhammer, i know. It works though.

For instance, if you want to remove the warning for 4099, open link.exe with an hex editor, goto line 15A0 which reads 03 10 (little endian for 4099) and replace it with FF 00 (which does not exist.)

Gurg Hackpof
  • 1,194
  • 10
  • 22
  • 5
    You should be looking for the sequence F8 0F 00 00 - 03 10 00 00 - 09 10 00 00 (4088, 4099, 4105 as 32 bit double words in little endian). It's the same in the amd64/link.exe. – Andreas Haferburg Aug 20 '13 at 13:15
8

For the benefit of others, I though I'd include what I did.

Since you cannot get Visual Studio (2010 in my case) to ignore the LNK4204 warnings, my approach was to give it what it wanted: the pdb files. As I was using open source libraries in my case, I have the code building the pdb files already.

BUT, the default is to name all of the PDF files the same thing: vc100.pdb in my case. As you need a .pdb for each and every .lib, this creates a problem, especially if you are using something like ImageMagik, which creates about 20 static .lib files. You cannot have 20 lib files in one directory (which your application's linker references to link in the libraries from) and have all the 20 .pdb files called the same thing.

My solution was to go and rebuild my static library files, and configure VS2010 to name the .pdb file with respect to the PROJECT. This way, each .lib gets a similarly named .pdb, and you can put all of the LIBs and PDBs in one directory for your project to use.

So for the "Debug" configuraton, I edited:

Properties->Configuration Properties -> C/C++ -> Output Files -> Program Database File Name from

$(IntDir)vc$(PlatformToolsetVersion).pdb

to be the following value:

$(OutDir)vc$(PlatformToolsetVersion)D$(ProjectName).pdb

Now rather than somewhere in the intermediate directory, the .pdb files are written to the output directory, where the .lib files are also being written, AND most importantly, they are named with a suffix of D+project name. This means each library project produduces a project .lib and a project specific .pdb.

I'm now able to copy all of my release .lib files, my debug .lib files and the debug .pdb files into one place on my development system, and the project that uses that 3rd party library in debug mode, has the pdb files it needs in debug mode.

Minok
  • 522
  • 4
  • 9
  • 2
    I'd say this is *the* answer to the question. The suggestion of PATCHING THE LINKER that many answers contain is asinine. Even if Microsoft is "wrong" about making this warning un-ignorable. – Tamás Szelei May 30 '16 at 14:01
  • 3
    This is the proper answer IF you are compiling the library from source. But some programs have dependencies on commercial libraries which do not include .pdb files, so generating a .pdb file for them isn't an option. – Bryce Wagner Nov 30 '17 at 19:06
3

I suspect /ignore is a VC6 link.exe option. for VS2005 and VS2008's linker there's no documented /ignore option available, but the linker looks just ignore the "/ignore:XXX" option, no error and no effect.

zhaorufei
  • 1,759
  • 17
  • 17
1

You cannot disable linker warning 4099, as said @John Weldon.

You should rebuild library with some project configuration changes. You have several options:

  • Save PDB file with debug information is same folder where you save .lib file. Set value "$(OutDir)$(TargetName).pdb" to Properties->C/C++->Output Files-Program Database File Name
  • Save debug information in .lib file. Set value "C7 compatible (/Z7)" to Properties->C/C++->General->Debug Information Format
  • Disable generation debug information for this library. Remove value from Properties->C/C++->General->Debug Information Format
KindDragon
  • 5,743
  • 4
  • 45
  • 72
1

The PDB file is typically used to store debug information. This warning is caused probably because the file vc80.pdb is not found when linking the target object file. Read the MSDN entry on LNK4099 here.

Alternatively, you can turn off debug information generation from the Project Properties > Linker > Debugging > Generate Debug Info field.

dirkgently
  • 101,474
  • 16
  • 123
  • 183
  • 3
    Turning off debug info solves the linker warnings, but then breakpoints do not work without debug information. That is not very useful for me. – Ashwin Nanjappa Mar 19 '09 at 11:31
  • 2
    Turning off warnings is never the right thing to do. Fix them. You need to find the pdb and see to it that it gets copied to the proper location. – dirkgently Mar 19 '09 at 11:35
  • Sigh, that is true! Sadly in this case, I cannot find that pdb. – Ashwin Nanjappa Mar 20 '09 at 04:38
  • 1
    vc80.pdb is just the default pdb name for vc8. This warning simply means that there is no debug information available for the CGAL library. It is safe to ignore. – JoeG Oct 04 '10 at 08:21
1

EDIT: don't use vc80 / Visual Studio 2005, but Visual Studio 2008 / vc90 versions of the CGAL library (maybe from here).

Linker Tools Warning LNK4099:

You could also compile with /Z7, so the pdb doesn't need to be used, or remove the /DEBUG linker option if you do not have .pdb files for the objects you are linking.

ax.
  • 53,672
  • 7
  • 72
  • 66
  • 2
    Thanks. Compiling with /Z7 still asks for the .pdb file of the CGAL library. /DEBUG solves the linker warnings, but then breakpoints do not work without debug information. – Ashwin Nanjappa Mar 19 '09 at 11:30