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
}
Pripomienky
https://aka.ms/ContentUserFeedback.
Pripravujeme: V priebehu roka 2024 postupne zrušíme službu Problémy v službe GitHub ako mechanizmus pripomienok týkajúcich sa obsahu a nahradíme ju novým systémom pripomienok. Ďalšie informácie nájdete na stránke:Odoslať a zobraziť pripomienky pre