CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2005
    Posts
    17

    Question 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!

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: atlconv.h header error!!!

    Try including altbase.h above the atlconv.h header.


    Arjay

  3. #3
    Join Date
    Mar 2004
    Posts
    382

    Re: atlconv.h header error!!!

    Quote 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.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  5. #5
    Join Date
    Jul 2005
    Posts
    17

    Re: atlconv.h header error!!!

    Quote 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

  6. #6
    Join Date
    Mar 2004
    Posts
    382

    Re: atlconv.h header error!!!

    Quote 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.

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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

  8. #8
    Join Date
    Jul 2005
    Posts
    17

    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
  •  





Click Here to Expand Forum to Full Width

Featured