Click to See Complete Forum and Search --> : Compiling MFC VC6.0 app with 7.0 VC .net gives error


Marzk
January 3rd, 2004, 01:25 AM
I have an MFC application written with VC++6.0, I compiled it with .net VC++ 7.0 and I got strange error:

error C2440: 'static_cast' : cannot convert from 'int (__thiscall CSepWin::* )(void)' to 'AFX_PMSG'

This error occurs when I include function that has any return value other than void in the ON_COMMAND statement. So, if function OnNewEditor has void return I do not get this error.

BEGIN_MESSAGE_MAP(CSepWin, CDialog)
// here is the error line
ON_COMMAND(IDM_NEW_EDITOR,OnNewEditor) END_MESSAGE_MAP()

Thankx,

Mark,

Andreas Masur
January 3rd, 2004, 04:44 AM
The definition of the 'ON_COMMAND' macro has changed from explicit casting to 'static_cast' from VC++ 6.0 to VC++ .NET. Thus, you need to change the function return type to 'void'.