Please forgive me if I ask the obvious question, but after going through a bunch of threads and trying things out, I canโt attach this simple thing.
I have this little program:
#define FUNC_PREFIX __FUNCTION__ "() :" int main() { printf("%s\n", FUNC_PREFIX); return 0; }
So I can pass FUNC_PREFIX instead of __FUNCTION__ to the log functions, and they will print the name of the calling function, followed by a pair and a colon, only to improve readability of the output lines of the log.
This compiles as it is in Visual Studio 2008. But in g++ , I get the expected error) before the string constant
I tried several things how to do:
#define TEMP __FUNCTION__ #define FUNC_PREFIX TEMP "() :"
but to no avail.
How can this be done?
source share