|
-
July 8th, 2005, 02:21 PM
#1
atlconv.h header error!!!
When I try to compile my VC++ program (am Using VS6.0). I get the following error in a header file ATLCONV.H.
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(52) : error C2065: '_ASSERTE' : undeclared identifier
Error executing cl.exe.
and it points to
Code:
inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars, UINT acp)
{
ATLASSERT(lpa != NULL); //points to this line. Error is here
ATLASSERT(lpw != NULL);
//rest of the header code
}
This is the only error I have. I tried to include assert.h but the error multiplies... so I had revert back. Since it is showing an error on the header file, is it BUG in the compiler or something? or am I seeing things differently?
My Main program has the following include statements
Code:
#include "asapdefs.h"
#include "atlconv.h"
#include "stdafx.h"
#include <string>
//#undef new
#import "..\..\SomeTLBfile.tlb" raw_interfaces_only
//someother code
Any inputs or thoughts????
Thanks a much!
-
July 8th, 2005, 02:30 PM
#2
Re: atlconv.h header error!!!
Try including altbase.h above the atlconv.h header.
Arjay
-
July 8th, 2005, 02:33 PM
#3
Re: atlconv.h header error!!!
 Originally Posted by karthik.t
Since it is showing an error on the header file, is it BUG in the compiler or something? or am I seeing things differently?
It's not a bug. Looking at the line of code you said it points to
Code:
ATLASSERT(lpa != NULL); //points to this line. Error is here
it means that lpa is a NULL pointer, which it should not be. To find out what the problem is, find the line of code from within your own code that leads to this error and post it on here so we can see what's going on.
-
July 8th, 2005, 02:46 PM
#4
Re: atlconv.h header error!!!
You need to use the USES_CONVERSION macro before using the convert functions.
Code:
{
USES_CONVERSION;
functionthattakesaTstring( W2T( wsz ) );
}
Arjay
P.S. Ignore the include atlbase.h comment above.
-
July 8th, 2005, 03:24 PM
#5
Re: atlconv.h header error!!!
 Originally Posted by Arjay
You need to use the USES_CONVERSION macro before using the convert functions.
Code:
{
USES_CONVERSION;
functionthattakesaTstring( W2T( wsz ) );
}
Arjay
P.S. Ignore the include atlbase.h comment above.
Hi Arjay!
Thanx a much! I pretty much new to programming... could you be a bit more clear? esp...
Code:
functionthattakesaTstring( W2T( wsz ) );
thnx again!
Karthik
-
July 8th, 2005, 03:31 PM
#6
Re: atlconv.h header error!!!
 Originally Posted by karthik.t
Hi Arjay!
Thanx a much! I pretty much new to programming... could you be a bit more clear? esp...
Code:
functionthattakesaTstring( W2T( wsz ) );
thnx again!
Karthik
All he's saying is that before calling any of the conversion macros, make sure you use the USES_CONVERSION statement.
The function functionthattakesaTstring is just an example. ********ing what he said, you can do two of the following
1.
Code:
// before calling the function that performs the conversion, add USES_CONVERSION
USES_CONVERSION
FunctionThatUsesConversion (...) // same as functionthattakesaTstring he metnions, it's just the name of the function that does the conversion, the name itself has no siginificance.
2.
Code:
// use USES_CONVERSION within the function that does the conversion
CMyClass::FunctionThatUsesConversion (...) {
USES_CONVERSION;
... Do you other calculations and coversions
return;
}
The bottom line is, before you call any of the conversion macros, add USES_CONVERSION.
-
July 8th, 2005, 03:31 PM
#7
Re: atlconv.h header error!!!
Aw, I got a bit thrown off by codeguruguy with my second post (my fault though). You are seeing the _ASSERTE error as you mentioned in your original post because the _ASSERTE macro hasn't been defined. I believe the answer is to include the "AtlBase.h" file as I mentioned earlier.
Try adding it to your include file list...
Code:
#include "asapdefs.h"
#include <atlbase.h>
#include "atlconv.h"
#include "stdafx.h"
#include <string>
//#undef new
#import "..\..\SomeTLBfile.tlb" raw_interfaces_only
//someother code
Arjay
-
July 8th, 2005, 03:35 PM
#8
Re: atlconv.h header error!!!
Yeah Arjay and CodeGuru!
I added altbase.h solved my error!!! :-)
gr8 thnx a much!!!
Karthik
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
|