Thread: L macro

  1. #1
    Registered User
    Join Date
    May 2006

    L macro

    Hello everyone,

    I am using Visual Studio 2003 and Windows Console project, I find when using L macro to convert character to wide character, the compiler will report an error that L macro is not defined.

    I find it is not defined in either <windows.h> or <TCHAR.h> -- when adding the two header files, the compile error is the same.

    Could anyone explain how to use L macro in Visual Studio 2003 and Windows Console project? Which header file is needed?

    thanks in advance,

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    There is no L macro, it is a prefix
    #include <stdio.h>
    #include <stdlib.h>
    int main(){
        wchar_t foo[] = L"hello";
        return 0;
    In your compiler, to permit easy switching between ASCII and UNICODE, there are the _T and _TEXT macros.
    Something like
    TCHAR foo[] = _TEXT("hello");

    See also
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Macro Program
    By daspope in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2004, 04:02 AM
  5. about Makefile and Macro
    By tom_mk in forum C++ Programming
    Replies: 1
    Last Post: 09-18-2003, 01:07 PM