November 17th, 2012 09:16 AM
#1
error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
I'm converting a working unicode app dll from vc6 to vs2008, but I'm getting a compile error: '_L': identifier not found
example line of code:-
if(*strPrinter==_L(""))
The program already includes: #include <AtlConv.h>
I have tried adding #include <wchar.h> and <tchar.h> to no avail.
NOTE: this is working on VS6, so maybe it's a problem with project settings somewhere??? any ideas?
Thanks,
Hobnob
November 17th, 2012 11:43 AM
#2
Re: error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
Are you getting mixed up with _T() ?? Assuming that *strPrinter can either be Unicode or non-Unicode (depending on the compilation) I think the syntax should be:-
Code:
if (*strPrinter == _T(""))
"A problem well stated is a problem half solved.” - Charles F. Kettering
November 18th, 2012 01:53 PM
#3
Re: error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
ok, worked it out... maybe my example wasn't clear enough, anyway:-
CStringW strLicenseKey = _L("TEXT HERE");
should be:- (to work on 2008)
CStringW strLicenseKey = L"INSERT_LICENSE_KEY_HERE";
November 18th, 2012 06:43 PM
#4
Re: error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
Originally Posted by
hobnob
should be:- (to work on 2008)
CStringW strLicenseKey = L"INSERT_LICENSE_KEY_HERE";
The correct way is to use
Code:
CStringW strLicenseKey = L"INSERT_LICENSE_KEY_HERE";
regardless of the compiler. So it isn't just to get it to work on 2008 -- you need to do this for any ANSI C++ compiler, let alone Visual C++.
I have never heard of the "_L" macro, but if it is a macro, take a look at the definition of what "_L()" is.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; November 18th, 2012 at 06:46 PM .
November 18th, 2012 02:10 PM
#5
Re: error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
ok, worked it out... maybe my example wasn't clear enough, anyway:-
CStringW strLicenseKey = _L("TEXT HERE");
should be:- (to work on 2008)
CStringW strLicenseKey = L"TEXT HERE";
November 20th, 2012 01:56 AM
#6
Re: error C3861: '_L': identifier not found in VS2008 only. (works ok in VC6)
Originally Posted by
hobnob
ok, worked it out... maybe my example wasn't clear enough, anyway:-
CStringW strLicenseKey = _L("TEXT HERE");
should be:- (to work on 2008)
CStringW strLicenseKey = L"TEXT HERE";
First, VC6 knows nothing about CStringW, as this type was introduced in VC7.
Second, a simple experiment:
Code:
#include <afxwin.h>
void foo ()
{
CString str = _L("Bla-bla");
}
Code:
E:\Temp\70>cl 70.cpp /D"_AFXDLL" /D"UNICODE" /D"_UNICODE" /MD /c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
70.cpp
70.cpp(5) : error C2065: '_L' : undeclared identifier
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks