/wd : supress warnings
/wdnnnn
supresses the compiler warning for the number nnnn
.
In the following simple example, the parameter
argc
is not referenced which causes the compiler to complain with the warning
C4100: 'argc': unreferenced formal parameter when compiling with
cl /W4 unreferenced-formal-parameter.c
.
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("Program name is %s\n", argv[0]);
}
The temptation is near to just remove argc
so that the function signature looks like int main(int, char* argv[])
, but this results in the error C2055: expected formal parameter list, not a type list.
The solution(?) is to suppress the warning (/wd4100
) and compile the program like so:
cl /wd4100 .\unreferenced-formal-parameter.c
Compare with the
/IGNORE
option of the linker (
link.exe
).