Geoff Chappell - Software Analyst
This option directs LINK to ignore the specified warnings.
/ignore:warning[[,warning]...]
At least one argument is required. All arguments must be numbers between 4000 and 4999 inclusive. It is a fatal error (LNK1147) if any argument does not evaluate satisfactorily.
The /ignore option is for the command line only. It is not valid as a directive in an object file.
In general, each of the specified warnings gets registered to be ignored. This means that should it occur, for whatever reason in whatever circumstances subsequent to the processing of this option, there will be no warning message and neither will its occurrence be treated as an error if the /wx option is active.
Some warning numbers are apparently too important to ignore:
LNK4017 | %S statement not supported for the target platform |
LNK4033 | converting object format from OMF to COFF |
LNK4044 | unrecognized option '/%S'; ignored |
LNK4062 | '%S' not compatible with '%S' target machine; option ignored |
LNK4075 | ignoring '/%S' due to '/%S' specification |
LNK4086 | entrypoint '%S' is not __stdcall with 12 bytes of arguments; image may not run |
LNK4088 | image being generated due to /FORCE option; image may not run |
LNK4099 | PDB '%S' was not found with '%S' or at '%S'; linking object as if no debug info |
LNK4105 | no argument specified with option '/%S'; ignoring option |
LNK4224 | %S is no longer supported; ignored |
LNK4228 | '/%S' invalid for a DLL; ignored |
LNK4229 | invalid directive '/%S' encountered; ignored |
To specify any of these in a /ignore option is not an error and brings no complaint. The specification is just not acted on. Should the specified warning ever occur, a warning message will still be displayed, and if the /wx option is active, the warning will still be promoted to an error.
As an aside, whichever of Microsoft’s programmers is currently in charge of LINK.EXE may care to note a small, presently inconsequential, coding error in the function that registers a warning number to be ignored. The unignorable warning numbers are defined as an array, with 12 members. In the loop that checks whether a warning number is in this array (and therefore not to be registered), the loop index presently runs to 48, i.e., to the sizeof the relevant array rather than to the number of elements in that array.
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
but note that 4208 can also occur in circumstances such that it is ignored independently of /wx.
There is presently one case of a warning being set to be ignored without the corresponding /ignore option being given explicitly. A side-effect of /subsystem:xbox is that warning 4078 gets registered internally as an ignored warning.
For who knows what reason, this obviously convenient switch is apparently undocumented. A corresponding switch for the compiler, /wd, has long been documented, as has a pragma for use in source code.
Though the /ignore switch may be undocumented, Microsoft has used it in the master makefiles for DDKs as far back as for NT 4.0. The warnings that Microsoft has found it necessary, or at least convenient, to disable in at least some cases when building device drivers over several DDK versions are:
LNK4001 | no object files specified; libraries used |
LNK4010 | invalid version number %S; default version assumed |
LNK4037 | '%S' does not exist; ignored |
LNK4039 | section '%S' specified with /SECTION option does not exist |
LNK4044 | unrecognized option '/%S'; ignored |
LNK4065 | '%S' cannot be ordered; ignored |
LNK4070 | /OUT:%S directive in .EXP differs from output filename '%S'; ignoring directive |
LNK4078 | multiple '%S' sections found with different attributes (%08X) |
LNK4087 | CONSTANT keyword is obsolete; use DATA |
LNK4088 | image being generated due to /FORCE option; image may not run |
LNK4089 | all references to '%S' discarded by /OPT:REF |
LNK4096 | /BASE value '0x%X' is invalid for Windows 95 and Windows 98; image may not run |
LNK4108 | /ALIGN specified without /DRIVER or /VXD; image may not run |
LNK4198 | base key '%S' not found - using default |
LNK4218 | non-native module found; restarting link with /LTCG |
LNK4221 | no public symbols found; archive member will be inaccessible |
LNK4235 | /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance |