Reputation: 89
I have this error coming up when I try to compile my C project.
error #20: identifier "someGetFunctionMacro" is undefined
This comes up at the line where I am using someGetFunctionMacroB()
in my code.
variable = someGetFunctionMacroB();
But here is what someGetFunctionMacroB()
is abstracting.
#define someGetFunctionMacro() someGetFunction(param1)
#define someGetFunctionMacroA() (someGetFunctionMacro == returnval1 ||\
someGetFunctionMacro == returnval2 ||\
someGetFunctionMacro == returnval3)
#define someGetFunctionMacroB() someGetFunctionMacroC() && (someGetFunctionMacroA() == 1)
I do not understand why the error is coming out when clearly identifier someGetFunctionMacro
is defined.
Upvotes: 0
Views: 441
Reputation: 409482
Function-like macros must be used like functions, with parentheses and all.
So if you have a macro like
#define someGetFunctionMacro() someGetFunction(param1)
you must "call" it like a function with the parentheses.
In the someGetFunctionMacroA
macro definition you don't use someGetFunctionMacro
correctly.
Upvotes: 3