Cannot instantiate abstract class due to following members
-
Hi all, Please, can I find somebody to help me in this problem, I'm using a custom made ATL component, I have the .h and .c, and I have put some create instance statments in my COM Client, but always I face this compile error on each create instance command : error C2259: 'CMyClass' : cannot instantiate abstract class due to following members: warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined Anybody can help in this problem? :( Yours, ShadiK. Shadi Al-Kahwaji
-
Hi all, Please, can I find somebody to help me in this problem, I'm using a custom made ATL component, I have the .h and .c, and I have put some create instance statments in my COM Client, but always I face this compile error on each create instance command : error C2259: 'CMyClass' : cannot instantiate abstract class due to following members: warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined Anybody can help in this problem? :( Yours, ShadiK. Shadi Al-Kahwaji
What does your CreateInstance code look like? The error is saying that your class hasn't implemented the IUnknown methods, QueryInterface, AddRef etc. However if you are trying to create a instance this shouldn't be happening as your COM DLL should have the implementation. Are you using smart pointers, #import or using CoCreateInstance? Michael :-)
-
What does your CreateInstance code look like? The error is saying that your class hasn't implemented the IUnknown methods, QueryInterface, AddRef etc. However if you are trying to create a instance this shouldn't be happening as your COM DLL should have the implementation. Are you using smart pointers, #import or using CoCreateInstance? Michael :-)
Hi, First thank you for your reply. Actually I'm using a ready made component which I don't know anything about how does it implemented, but I have the component.h and component_i.c files, and I'm linking to the component using these two files and the ofcourse the .DLL itself. No #import, no smart pointers, just CoCreateInstance which directly creates the required interfaces, and on those CoCreateInstance statement I have this error. Regards, ShadiK. Shadi Al-Kahwaji
-
Hi all, Please, can I find somebody to help me in this problem, I'm using a custom made ATL component, I have the .h and .c, and I have put some create instance statments in my COM Client, but always I face this compile error on each create instance command : error C2259: 'CMyClass' : cannot instantiate abstract class due to following members: warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined Anybody can help in this problem? :( Yours, ShadiK. Shadi Al-Kahwaji
Can you post some of the problematic code? Usually that error happens when you try to use use
new
to create an ATL class, which is the wrong way to do it, but you said you're using CreateInstance. Does the class have a BEGIN_COM_MAP()/END_COM_MAP() section? --Mike-- http://home.inreach.com/mdunn/ :love: your :bob: with :vegemite: and :beer: -
Hi, First thank you for your reply. Actually I'm using a ready made component which I don't know anything about how does it implemented, but I have the component.h and component_i.c files, and I'm linking to the component using these two files and the ofcourse the .DLL itself. No #import, no smart pointers, just CoCreateInstance which directly creates the required interfaces, and on those CoCreateInstance statement I have this error. Regards, ShadiK. Shadi Al-Kahwaji
I need to see the CoCreateInstance code fragment to help more. It seems like you are trying to create the c++ class instead of the interface. Michael :-)
-
Hi all, Please, can I find somebody to help me in this problem, I'm using a custom made ATL component, I have the .h and .c, and I have put some create instance statments in my COM Client, but always I face this compile error on each create instance command : error C2259: 'CMyClass' : cannot instantiate abstract class due to following members: warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined Anybody can help in this problem? :( Yours, ShadiK. Shadi Al-Kahwaji
Sound similar to an error I have made when initially typing code. Many times I do not declare the pointer to the COM object as a pointer and it gives the error you state. THis is correct: IXMLDOMDocument *pXML = NULL; hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&pXML); // Check the return value, hr... ASSERT(SUCCEEDED(hr) && pXML!=NULL); This is not: IXMLDOMDocument pXML = NULL; << this line produces the error not the next! hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&pXML); // Check the return value, hr... ASSERT(SUCCEEDED(hr) && pXML!=NULL); Michael A Barnhart mabtech@swbell.net
-
Sound similar to an error I have made when initially typing code. Many times I do not declare the pointer to the COM object as a pointer and it gives the error you state. THis is correct: IXMLDOMDocument *pXML = NULL; hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&pXML); // Check the return value, hr... ASSERT(SUCCEEDED(hr) && pXML!=NULL); This is not: IXMLDOMDocument pXML = NULL; << this line produces the error not the next! hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument2, (void**)&pXML); // Check the return value, hr... ASSERT(SUCCEEDED(hr) && pXML!=NULL); Michael A Barnhart mabtech@swbell.net
Thank you sir. And I would like to thank everybody tried to help me. The problem is that I was trying to use the COM component as a smart pointers, but there were not.:laugh: Thank you all again. Shadi Al-Kahwaji