I have some code that compiles and links fine in VC6 but does not
link in VC7. Here are the relevant parts of the code:
class AView : public CScrollView
{
....
public:
AFX_DISPMAP_ENT RY* _dispatchEntrie s;
UINT _dispatchEntryC ount;
DWORD _dwStockPropMas k;
AFX_DATA AFX_DISPMAP dispatchMap;
#ifdef _AFXDLL
static const AFX_DISPMAP* PASCAL _GetBaseDispatc hMap();
#endif
virtual const AFX_DISPMAP* GetDispatchMap( ) const;
}
void AView::MakeMap( )
{
#ifdef _AFXDLL
dispatchMap.pfn GetBaseMap = _GetBaseDispatc hMap;
#else
dispatchMap.pBa seMap = &CScrollView::d ispatchMap;
#endif
_dispatchEntrie s = new AFX_DISPMAP_ENT RY[nSize];
dispatchMap.lpE ntries = _dispatchEntrie s;
dispatchMap.lpE ntryCount = &_dispatchEntry Count;
dispatchMap.lpS tockPropMask = &_dwStockPropMa sk;
_dispatchEntryC ount = (UINT) -1;
_dwStockPropMas k = (DWORD)-1;
}
#ifdef _AFXDLL
const AFX_DISPMAP* PASCAL AView::_GetBase DispatchMap()
{ return &CScrollView::d ispatchMap; }
const AFX_DISPMAP* AView::GetDispa tchMap() const
{ return &dispatchMap ; }
#else
const AFX_DISPMAP* AView::GetDispa tchMap() const
{ return &dispatchMap ; }
#endif
During linking, I get the following error:
error LNK2001: unresolved external symbol "protected: static struct
AFX_DISPMAP const CCmdTarget::dis patchMap"
(?dispatchMap@C CmdTarget@@1UAF X_DISPMAP@@B)
My /LIBPATH includes Vc7/atlmfc/lib which is where I'm
assuming the necessary library resides.
There was a virtually identical problem submitted to
microsoft.publi c.languages.vc
on July 30, 2002 by sunil, but there was no response.
I would appreciate suggestions how to resolve this.
Tom