473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Link error LNK2001 in VC7

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_ENTRY* _dispatchEntries;
UINT _dispatchEntryCount;
DWORD _dwStockPropMask;
AFX_DATA AFX_DISPMAP dispatchMap;
#ifdef _AFXDLL
static const AFX_DISPMAP* PASCAL _GetBaseDispatchMap();
#endif
virtual const AFX_DISPMAP* GetDispatchMap() const;

}
void AView::MakeMap()
{
#ifdef _AFXDLL
dispatchMap.pfnGetBaseMap = _GetBaseDispatchMap;
#else
dispatchMap.pBaseMap = &CScrollView::dispatchMap;
#endif
_dispatchEntries = new AFX_DISPMAP_ENTRY[nSize];
dispatchMap.lpEntries = _dispatchEntries;
dispatchMap.lpEntryCount = &_dispatchEntryCount;
dispatchMap.lpStockPropMask = &_dwStockPropMask;
_dispatchEntryCount = (UINT) -1;
_dwStockPropMask = (DWORD)-1;
}

#ifdef _AFXDLL
const AFX_DISPMAP* PASCAL AView::_GetBaseDispatchMap()
{ return &CScrollView::dispatchMap; }
const AFX_DISPMAP* AView::GetDispatchMap() const
{ return &dispatchMap; }
#else
const AFX_DISPMAP* AView::GetDispatchMap() const
{ return &dispatchMap; }
#endif

During linking, I get the following error:
error LNK2001: unresolved external symbol "protected: static struct
AFX_DISPMAP const CCmdTarget::dispatchMap"
(?dispatchMap@CCmdTarget@@1UAFX_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.public.languages.vc
on July 30, 2002 by sunil, but there was no response.

I would appreciate suggestions how to resolve this.
Tom

Nov 17 '05 #1
3 3114
Hi Tom,

This is because MFC7.0 and 7.1 no longer export CCmdTarget::dispatchMap
from the MFC DLL's, if you look in the corresponding DEF file the export is
no longer present. You can also find this out by doing a dumpbin /Exports
on the lib file that you are linking to.

Since this is a member you can only access it if you are inheriting from
the class anyway and the best thing to do is use the Accessor functions
that are provided to
us. you simply need to change the function to call
CCmdTarget::GetThisDispatchMap()
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 17 '05 #2
Hi Gary,

That worked. Thank you very much.

Tom

"Gary Chang[MSFT]" wrote:
Hi Tom,

This is because MFC7.0 and 7.1 no longer export CCmdTarget::dispatchMap
from the MFC DLL's, if you look in the corresponding DEF file the export is
no longer present. You can also find this out by doing a dumpbin /Exports
on the lib file that you are linking to.

Since this is a member you can only access it if you are inheriting from
the class anyway and the best thing to do is use the Accessor functions
that are provided to
us. you simply need to change the function to call
CCmdTarget::GetThisDispatchMap()
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 17 '05 #3
OK, Tom,

I am very glad to know it resolved your problem, good luck!
Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rodolphe | last post by:
Hello, I'm French so sorry for my approximate English. When I try to compile a project under Visual C++ 6.0, I've got the following errors : applicap.obj : error LNK2001: unresolved external...
1
by: Don Kim | last post by:
I'm trying to compile the following code from "C++ Templates" Book by Josuttis and Vandervoorde, and I keep getting link errors: //coord.hpp #include <cstdlib> class Coord { private: int x,...
2
by: Helen | last post by:
Hi I am trying to compile a package of avi to mpeg1 C source codes But I got the link error I searched actually my VFW.h and Vfw32.lib are all in the directory what should I do thanks a lot...
3
by: Leith Bade | last post by:
I have been trying to use the new Visual C++ Toolkit 2003 with the VC6 IDE I set up the executable, inlcude, and library directories to point to the new compilers I had to fix a few errors in the...
2
by: PDHB | last post by:
Hi. I'm trying to migrate a small library to VC8 via the wizard, but when I try to compile I get the following errors: Error 1 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"...
4
by: Sanjay Kumar | last post by:
Folks ! I am working with VC++ after a long time and having problem linking latest xerces 2.7 in VC++ 2005 Express Edition. I have done following: 1. downloaded and unpacked the the...
1
by: developer | last post by:
Hi All I have made a .NET project. the files included are borland c++ files that i am migrate to VC++ .NET I am using Microsoft Visual C++ .NET 2003. the compilation goes through properly,...
5
by: eberesche | last post by:
Hello, as a novice in ASN.1 I have me to a project in C ++ under use of ASN.1 - structures risquély. One of my colleagues means, this would deal something with masochism ;-). Result should be a DLL...
10
by: k.jayachandran | last post by:
I have a very curious and unique problem here. I'm creating a parser using bison and flex. i did all the development work in a linux environment. the project includes the source files output from...
2
by: Angus | last post by:
Hello I am using some classes from a third party and have included them in my projecxt and am compiling and linking with them. Everything compiles ok but I get these link errors: I added...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.