Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2009

Error Message

reuse of macro formal 'identifier'

The formal parameter list of a macro definition uses the identifier more than once. Identifiers in the macro's parameter list must be unique.


The following sample generates C2009:

// C2009.cpp
#include <stdio.h>

#define macro1(a,a) (a*a)   // C2009

int main() 
    printf_s("%d\n", macro1(2));

Possible resolution:

// C2009b.cpp
#include <stdio.h>

#define macro2(a)   (a*a) 
#define macro3(a,b) (a*b)

int main() 
    printf_s("%d\n", macro2(2));
    printf_s("%d\n", macro3(2,4));

Community Additions

© 2015 Microsoft