Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
}