Problems with macros

Alexander.Schmid@RSD.rohde-schwarz.com Alexander.Schmid@RSD.rohde-schwarz.com
Wed Dec 11 06:07:00 GMT 2002


Hi everybody,

My system configuration: Suse Linux 8.1, gcc 3.2.

I´m porting some Windows stuff to Linux. To provide Unicode support, I use the
_T(x) macro from windows <tchar.h> , which actually puts an 'L' in front of the
text 'x'. The definition sounds like this:
#define _T(x)  L ## x

This works just fine when x is a string with quotationmarks or a character, like
_T("hello world") or _T('c'), but now I encountered a problem. When I call
_T(__FILE__), gcc seems just to interpret the _T macro and not the __FILE__
macro, so it leads to an error: "L__FILE__ not known", but the result should be
the actual file name in Unicode (The _T(__FILE__) works in Visual C++, so I
think it´s a gcc problem).

Can anybody tell me why this is and how I can get around this (perhaps a special
compiler flag?), or is there no hope for this problem?

Thanks in advance,
Alex







More information about the Gcc-help mailing list