473,659 Members | 3,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_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

Nov 17 '05 #1
3 3138
Hi Tom,

This is because MFC7.0 and 7.1 no longer export CCmdTarget::dis patchMap
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::Get ThisDispatchMap ()
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::dis patchMap
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::Get ThisDispatchMap ()
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
10074
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 symbol _IID_ISampleGrabber applicap.obj : error LNK2001: unresolved external symbol _CLSID_NullRenderer applicap.obj : error LNK2001: unresolved external symbol
1
1465
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, y; public: Coord (int i1, int i2) : x(i1), y(i2) {
2
6912
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 Linking... Avi2mpg1.obj : error LNK2001: unresolved external symbol _AVIFileExit@0 Avi2mpg1.obj : error LNK2001: unresolved external symbol _AVIFileRelease@4 Avi2mpg1.obj : error LNK2001: unresolved external symbol _AVIStreamGetFrameC lose@4
3
7365
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 MFC6 <afxtempl.h> to get it to compile with the better standards confomance (mainly omitted typename, and lazyness with specialized templates - using BASE_CLASS & TYPE instead of CObList & CObList*) Now I get some strange linker errors, and I don't...
2
5530
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" (?.cctor@@$$FYMXXZ) AssemblyInfo.obj Error 2 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) AssemblyInfo.obj Error 3 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ) Stdafx.obj
4
6400
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 library: http://www.apache.org/dist/xml/xerces-c/binaries/xerces-c_2_7_0-windows_2000-msvc_60.zip
1
3284
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, but throws a load of linker errors
5
2845
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 which provides the exchange of documents between a DMS and a remote data base. My developing environment is MSVS v.7.1, and the ASN.1 - source texts are generated with the compiler asn1c-0.9.20. Therefore I have in the project cpp-, as well as c...
10
2837
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 flex and bison, then several cpp files to create a data structure from the parser. i used gcc as the compiler for the flex output(as it is a c file) and g++ as the compiler for the remaining source files. linked all the object files to create the...
2
2992
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 all your files to my project and recompiled. Now everything compiles as before but get these link errors:
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.