Sanjeet Joshi
April 15th, 1999, 04:09 AM
THE SOULUTION IN THE REPLY GIVEN TO THIS MESSAGE BY ANONYM DID NOT WORK !!!
HI,
I am writting a DLL of custom controls. i.e. some additional features added to existing windows controls. So I have written this CMyListCtrl class that enhances CListCtrl MFC class. The class is exported as following :
class __declspec(dllexport) CMyListCtrl : public CListCtrl
{
//class body goes here
};
The dll is created without any problems.
I can use this dll and the control class in other applications, and make use of CMyListCtrl where ever I can. There is no problem in it.
The problem starts when I try to inherit another class from CMyListCtrl in some other application.
For e.g. I create another project import the dll of custom controls.
Then I write a class as following:
class CAnotherListCtrl : public CMyListCtrl
{
//class body.
};
When I compile the application linker gives me following error :
TestListCtrl.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CMyListCtrl::messageMap" (?messageMap@CMyListCtrl@@1UAFX_MSGMAP@@B)
Debug/DLLUseTest.exe : fatal error LNK1120: 1 unresolved externals
I suspected it is because of the DECLARE_MESSAGE_MAP() or BEGIN_MESSAGE_MAP() macros. So I changed the BEGIN_MESSAGE_MAP macro from :
BEGIN_MESSAGE_MAP(CAnotherListCtrl, CMyListCtrl)
to
BEGIN_MESSAGE_MAP(CAnotherListCtrl, CListCtrl)
and the error was gone. But obviously all the message handling in CMyListCtrl was gone.
Does anybody know whats happening ? So the basic question would be 'How do we write a library of Custom controls (inherited from MFC) that can be used to further define new clasees ?'
Is this because something is not getting exported properly ?
Please feedback
Sanjeet.
HI,
I am writting a DLL of custom controls. i.e. some additional features added to existing windows controls. So I have written this CMyListCtrl class that enhances CListCtrl MFC class. The class is exported as following :
class __declspec(dllexport) CMyListCtrl : public CListCtrl
{
//class body goes here
};
The dll is created without any problems.
I can use this dll and the control class in other applications, and make use of CMyListCtrl where ever I can. There is no problem in it.
The problem starts when I try to inherit another class from CMyListCtrl in some other application.
For e.g. I create another project import the dll of custom controls.
Then I write a class as following:
class CAnotherListCtrl : public CMyListCtrl
{
//class body.
};
When I compile the application linker gives me following error :
TestListCtrl.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CMyListCtrl::messageMap" (?messageMap@CMyListCtrl@@1UAFX_MSGMAP@@B)
Debug/DLLUseTest.exe : fatal error LNK1120: 1 unresolved externals
I suspected it is because of the DECLARE_MESSAGE_MAP() or BEGIN_MESSAGE_MAP() macros. So I changed the BEGIN_MESSAGE_MAP macro from :
BEGIN_MESSAGE_MAP(CAnotherListCtrl, CMyListCtrl)
to
BEGIN_MESSAGE_MAP(CAnotherListCtrl, CListCtrl)
and the error was gone. But obviously all the message handling in CMyListCtrl was gone.
Does anybody know whats happening ? So the basic question would be 'How do we write a library of Custom controls (inherited from MFC) that can be used to further define new clasees ?'
Is this because something is not getting exported properly ?
Please feedback
Sanjeet.