C2542 What does this one mean? 
Author Message
 C2542 What does this one mean?

Hi all,

I'm getting following error:

... atlcomcli.h(101) error C2542: 'IElementHandler' class object has no
constructor for initialization.
This diagonstic occured in compiler generated function
'CSoapEnvelopeHandler::CSoapEnvelopeHandler'

First of all i don't get any information about the source code line. I guess
this because the error occurs in a compiler generated function. But I have
absolutely no idea why the compiler points to CComPtrBase::CComPtrBase()
(atlcomcli.h ln 101).

BTW.: The template parameter T is not printed out.

It reads:
CComPtrBase() throw()
{
    p = NULL;

Quote:
}

Why do we need a CSoapEnvelopeHandler here ?

Here are my classes

__interface IElementHandler /*no base*/
{
    // 2 functions

Quote:
};

class CSoapEnvelopeHandler :
    public IElementHandler
{
    // same 2 functions implemented

Quote:
};

I can instantiate a CSoapEnvelopeHandler by adding
CSoapEnvelopeHandler h; into my main function.

I have an CAtlArray < CSoapEnvelopeHandler >
somewhere. No CComPtr in or with
CSoapEnvelopeHandler or IElementHandler.

Could someone explain the error.

I will try to create a small repro. But till then I would
greatly appreciate any input about this issue.

tia & Cheerio!

hg



Mon, 10 Jan 2005 19:18:44 GMT  
 C2542 What does this one mean?
I managed to track it down to the following problem:

__interface I    // This one causes the error
// With following line is ok
// class __declspec(novtable) I
{
 virtual void Foo() = 0;

Quote:
};

class C : public I
{
 void Foo(){}

Quote:
};

int main()
{
 C c;
 C d = c;
    // C2542

Quote:
}

I wonder if this was intended. For the __interface C::C() does not
invoke I::I(). But the compiler wants I::I(const I&) for C::C( const C& ).

That seems quite peculiar.

BTW: In my version the compiler also reports the wrong source
location for the error under some cirumstances. I haven't been able
to create a repro yet.

Regards
-hg



Tue, 11 Jan 2005 08:40:59 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Some one 's done his homework

2. Any one done Tooltips in Property sheet?

3. comparing digits one by one

4. Creating separate text files from one large one

5. passing more than one type of argument to one function

6. Create one singleton object in other interface's method (in one project)

7. How to add one to one relationship in access97 database thru SQL

8. turn one computer into more than one

9. I'll bet no one can answer this one

10. from one CEdit to one another

11. Why does strlen crash my sys one this one string

12. Same Variable Name: One Global, One Local

 

 
Powered by phpBB® Forum Software