Compiler Error C2004
expected 'defined(id)'
An identifier must appear in the parentheses following the preprocessor keyword.
This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: missing parenthesis in preprocessor directive. If the closing parenthesis is missing from a preprocessor directive, the compiler will generate an error.
Examples
The following sample generates C2004:
// C2004.cpp
// compile with: /DDEBUG
#include <stdio.h>
int main()
{
#if defined(DEBUG // C2004
printf_s("DEBUG defined\n");
#endif
}
Possible resolution:
// C2004b.cpp
// compile with: /DDEBUG
#include <stdio.h>
int main()
{
#if defined(DEBUG)
printf_s("DEBUG defined\n");
#endif
}