if I do:
void foo() {
if( .. ) {
inline int baa(..) { return .. }
} else {
inline int baa(..) { return .. }
}
}
And call: baa(..) inside foo function I get implicit declaration of 'baa'.
But if I do prototype declaration: inline int baa(int); the error is inline function 'baa' declared but never defined. I’m using inline function to replace macro-function.
How to fix this?
EDIT
better: can someone explain why the compiler claims the above error message?
You cannot define functions inside functions, you can only declare them. Declaring them makes their names visible in that scope but those functions still need a definition somewhere, and we know we cannot define them within another function. That’s why the compiler says that the function was declared but never defined.
Instead, simply declare your functions
inlineat a global scope.