Linker errors in VC7 when using RichEdit view

S

Senapathy

VC++ .NET 2003 Standard Edition
Win XP, SP2

Hi,

I have a code that builds under VC6.0, but fails to link in VC7.1.

The offending code is as follows:

_AFX_RICHEDIT_STATE* const pEditState = _afxRichEditState;

The linker errors are:

----------------------

LVBaseDetailsView.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) class CProcessLocal<class _AFX_RICHEDIT_STATE>
_afxRichEditState"
(__imp_?_afxRichEditState@@3V?$CProcessLocal@V_AFX_RICHEDIT_STATE@@@@A)

LVBaseDetailsView.obj : error LNK2019: unresolved external symbol "public:
virtual __thiscall _AFX_EDIT_STATE::~_AFX_EDIT_STATE(void)"
(??1_AFX_EDIT_STATE@@UAE@XZ) referenced in function $L153022

LVBaseDetailsView.obj : error LNK2019: unresolved external symbol "public:
__thiscall _AFX_EDIT_STATE::_AFX_EDIT_STATE(void)"
(??0_AFX_EDIT_STATE@@QAE@XZ) referenced in function "public: static class
CNoTrackObject * __stdcall CProcessLocal<class
_AFX_RICHEDIT_STATE>::CreateObject(void)"
(?CreateObject@?$CProcessLocal@V_AFX_RICHEDIT_STATE@@@@SGPAVCNoTrackObject@@XZ)

LVBaseDetailsView.obj : error LNK2019: unresolved external symbol "public:
virtual __thiscall _AFX_RICHEDIT_STATE::~_AFX_RICHEDIT_STATE(void)"
(??1_AFX_RICHEDIT_STATE@@UAE@XZ) referenced in function "public: virtual
void * __thiscall _AFX_RICHEDIT_STATE::`scalar deleting destructor'(unsigned
int)" (??_G_AFX_RICHEDIT_STATE@@UAEPAXI@Z)

----------------------

The code above is part of legacy code, which I am porting to the .NET
compiler. I cannot drastically change the code to do away with such things
since I saw in the code documentation that this was introduced to solve some
bug where the code crashes if a find dialog is opened in a RichEdit view.


When I searched MSDN / Google I found very little information regarding
this. Later I realized it may be because _afxRichEditState is an
undocumented class, derived from the undocumented CNoTrackObject.

Does anyone know of this problem and a solution to this?
Should I link to some library explicitly in VC7 .NET?

Warm regards,
Sena
 
T

Ted

Unfortunately those symbols are no longer exported in the release version of
MFC71.DLL. They are only exported in the debug versions. I'm not sure if
this was an oversight on Microsoft's part or whether it was by design.

To verify this, you can do a "find in files" of afxRichEditState in the DEF
files in the installation folders. Notice under VC6.0 it shows up under
both the debug and release DEF files. Under 7.1 it only shows in the debug
DEF files.

The fix you talked about is already fixed in VC7.1, so maybe you could
change your code back to using the standard rich edit control, and not your
own copy. Or to properly fix the problem, bring in all the definitions of
the classes you need (copy them in)

Ted.
 
S

Senapathy

Hi Ted,

Thanks for the info ! I too finally resorted to commenting out the offending
code to get it built, but didn't know if it was alright.
Can you point out for me if it is documented somewhere that the original bug
in RichEdit view is fixed in VC7.1?
( just to appease the Q guys if they ask how I can comment out code
arbitrarily during porting to .NET compiler! )

Regards,
Sena
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top