您的位置:首页 > 其它

mfc程序遇到的一些错误

2012-03-09 00:00 363 查看
1.Error 1 error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(NMTOOLBARA *,LRESULT *)' to 'void (__thiscall CCmdTarget::* )(NMHDR *,LRESULT *)' d:/作业项目相关/12452121/mainfrm.cpp 33 Myimgapp

应该是
afx_msg void OnToolbarDropDown(NMHDR * pnmh, LRESULT* plRes);
注意NMHDR是NOTIFY事件的标准参数,对于不同的事件你可以在事件内做相应类型的强制转换
如:
NMTOOLBAR* pnmhToolBar = (NMTOOLBAR*)pnmh;

http://topic.csdn.net/t/20040917/11/3382544.html

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

2.error C2440: ’static_cast’ : cannot convert from ‘UINT (__thiscall CStaticLink::* )(CPoint)’ to ‘LRESULT (__thiscall CWnd::* )(CPoint)’

If you are updating from VS2003 to VS2005, C++, you might run across an error like this. What it means is that they changes the return types from 2003 to 2005. You just need to change the UINT to an LRESULT and you should be good to go.

http://blog.stevienova.com/2007/02/28/error-c2440-static_cast-cannot-convert-from-uint-__thiscall-cstaticlink-cpoint-to-lresult-__thiscall-cwnd-cpoint/

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

3.warning LNK4076: invalid incremental status file

rebuild all一下应该就没事了

http://topic.csdn.net/t/20020314/15/575784.html

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

4.warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.

这个是编译使用了老的向导生成的MFC代码时遇到的问题,一个典型的告警信息输出如下所示:
CrpFileCrack.cpp
f:/project/...../crpfilecrack.cpp(52) : warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed. You should remove this call.
e:/software/microsoft visual studio 9.0/vc/atlmfc/include/afxwin.h(4818) : see declaration of 'CWinApp::Enable3dControls'
通常向导生成的代码是:
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
这两个函数的调用是旧的MFC版本对新版本的操作系统特性的支持,在新的(那个时候是新的)Windows 95平台上要这样调用一下才能使用新的Windows 3D样式的控件,否则就是老的Win 3.2样子的控件。想当初喜欢OWL就是因为感觉它的控件比较“酷”,比如那个带底纹的对话框,菱形的checkbox,还有带图标的“OK”按钮,看到 MFC作出来的灰灰的界面就觉得土,不过后来就知道MFC做界面也是很漂亮的,比如我做的。。。。,再打住。对于新的MFC版本来说已经不需要再调用这两个函数了,参考前面的方法,用_MSC_VER对其隔离就行了:
#if _MSC_VER <= 1200 // MFC 6.0 or earlier
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#endif

http://blog.csdn.net/orbit/archive/2008/11/28/3405309.aspx

--------------------------------以上是编译mfc显示jpg格式的程序(网上载的)遇到的问题---------------------------

--------------------在vc6中编译原来的代码通过,在vs2008中遇到以上错误,改完后编译通过-------------------

5.warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss

http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=2664 参考

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

6.error C3861: 'PathFindExtension': identifier not found

If you see these errors like this below, do including #include . Good luck.

C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(5934) : error C3861: 'PathFindExtension': identifier not found, even with argument-dependent lookup
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6239) : error C2061: syntax error : identifier 'DLLVERSIONINFO'
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6244) : error C2065: 'DLLGETVERSIONPROC' : undeclared identifier
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6244) : error C2146: syntax error : missing ';' before identifier 'pfnDllGetVersion'
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6244) : error C2065: 'pfnDllGetVersion' : undeclared identifier
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6244) : error C2143: syntax error : missing ';' before 'GetProcAddress'
C:/Program Files/Microsoft Visual Studio .NET 2003/Vc7/atlmfc/include/atlbase.h(6244) : error C3861: 'DLLGETVERSIONPROC': identifier not found, even with argument-dependent lookup

http://cid-0fe018764d78a562.spaces.live.com/blog/cns!FE018764D78A562!134.entry

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/dengjiang1999/archive/2009/04/17/4086217.aspx

$(document).ready(function(){dp.SyntaxHighlighter.HighlightAll('code');});

原文链接:
http://blog.csdn.net/augusdi/article/details/4348350
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: