Compiler Warning (level 4) C4100
Learn more about: Compiler Warning (level 4) C4100
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
'identifier' : local variable is initialized but not referenced
A variable is declared and initialized but not used.
The following sample generates C4189:
// C4189.cpp
// compile with: /W4
int main() {
int a = 1; // C4189, remove declaration to resolve
}
Starting in Visual Studio 2017 version 15.5, warning C4189 is emitted in more cases, as shown in the following code:
void f() {
char s[2] = {0}; // C4189. Either use the variable or remove it.
}
To fix the error, remove the unused variable.
Learn more about: Compiler Warning (level 4) C4100
Learn more about: Compiler Warning (level 1) C4273
Reference for the Microsoft C/C++ compiler options: /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, and /WX.
Reference guide to the Microsoft C++ /permissive- (Standards conformance) compiler option.
Submit and view feedback for