I’m trying to make my project compile under GCC (Visual Studio compiles it flawlessly).
I have a custom assert function which throws a wstring message. A part of it is the _ _FUNCTION__ macro, which I “unicodize” using the WIDEN macro from MSDN
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)
It compiles okay in MSVC, but it prints this in GCC:
error: ‘L__FUNCTION__’ was not declared in this scope
The only solution I could come with is to convert the contents of __FUNCTION __ to wstring on runtime using mbstowcs, but I would like to find a compile-time way to do it.
Thanks for help.
In GCC
__FUNCTION__is a non-standard extension. To quote: GCC Online DocsSo adding L on the front of
__FUNCTION__is just going to turn it intoL__FUNCTION__which is probably undefined.