comdef.h compiler error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have a VC++ project that I want to use a COM library in. So, I import
my COM dll with an absolute path (since it's in my VS project
directory) like this.

#import "C:\\...\\MyDLL.dll"

But, when I go to compile my project that uses that COM DLL, I get an
error in comdef.h. This error doesn't appear when I don't import, and I
have no trouble compiling and registering the DLL itself.

Error 1 error C2589: '(' : illegal token on right side of
'::' C:\...\comdef.h 240
Error 2 error C2059: syntax error : '::' C:\...\comdef.h 240
Error 3 fatal error C1903: unable to recover from previous error(s);
stopping compilation c:\...\windows mobile 5.0 pocket pc sdk

The actual comdef.h line is:

inline const TCHAR * _com_error::ErrorMessage() const throw()
{
if (m_pszMsg == NULL) {

FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
m_hresult,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&m_pszMsg,
0,
NULL);
if (m_pszMsg != NULL) {
int nLen = ::lstrlen(m_pszMsg); //compiler error here!
//...
}

Is there a setting, or something I'm missing to get this to work that
anybody can see?

Thanks,
Paul H

.



Relevant Pages

  • Re: comdef.h compiler error
    ... PaulH wrote: ... my COM dll with an absolute path (since it's in my VS project ... have no trouble compiling and registering the DLL itself. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Random file access -cont
    ... That helps, thanks Paul! ... > You can call anything in any DLL anywhere on the device, ... > Download the OpenNETCF SDF and look through the source code. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Exporting classes
    ... Paul T. ... We know nothing about what this DLL is ... Chris Tacke, Embedded MVP ... #define EXPORTMODIFICATION declspec ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: file system driver integration with Window CE device
    ... Thanks for the information tobey, will give it a try and then get back. ... Paul G. Tobey wrote: ... I am a newbie to the pocketPC environment and new to driver ... Then downloaded my dll into the 'windows' folder. ...
    (microsoft.public.windowsce.embedded)
  • Re: implicit loading of dll ?
    ... Paul T. ... copy the lib and dll to the debug folder or the release folder... ... to worry about putting its data in the precompiled header file. ...
    (microsoft.public.windowsce.app.development)