1 错误 1 error C2440: “static_cast”: 无法从“UINT (__thiscall CCoolBar::* )(CPoint)”转换为“LRESULT (__thiscall CWnd::* )(CPoint)”
afx_msg UINT OnNcHitTest(CPoint point);
UINT CTestDlg::OnNcHitTest(CPoint point)
=>
afx_msg LRESULT OnNcHitTest(CPoint point);
LRESULT CTestDlg::OnNcHitTest(CPoint point)
2 #ifndef _USE_32BIT_TIME_T
#define _USE_32BIT_TIME_T
#endif
3
将一个项目由vc6转 到vc7下面,ON_NOTIFY的NMTOOLBAR老是提示错误 error C2440: “static_cast” : 无法从“void (__thiscall CMainFrame::* ) (NMTOOLBARA *,LRESULT *)”转换为“void (__thiscall CCmdTarget::* ) (NMHDR *,LRESULT *)”
解决方法:
VC6下OnToolbarDropDown的函数原型: void CMainFrame::OnToolbarDropDown(NMTOOLBAR* pnmtb, LRESULT *plr) 把他改成: void CMainFrame::OnToolbarDropDown(NMHDR* pnmhdr, LRESULT *plr)
在函数实现里加上强制转换
LPNMTOOLBAR pnmtb = reinterpret_cast<LPNMTOOLBAR>(pnmhdr);
4
1.看看你Include路径(设置里面调)包没包含标准库路径 2.试试 #include <iostream.h> 或 #include <iostream> using namespace std;
1.如果MessageBox("aa") 报错,将其要改成 MessageBox(_TEXT("aa")).我喜欢用MessageBox来调试程序,尤其是在写脚本时,当你不知道程序有没有执行该条语句,以及执行完该条语句后某个变量的值发生了什么变化,在该条语句前后各加一个MessageBox(str),一目了然了吧
2.pow(2,10) 要改成 pow((double)2,10)或pow(2.0,10)
说明:6.0中用到math.h pow()函數時,有這個原型 double pow(int _X,int _Y) 但如果用VC++ 2005的話,pow()的第一個參數就不能再使用int型態,只能使用float、double、long double,VC++ 2005在編譯時會做type checking,然後就過不了,报error C2668
3.Itoa方法名要改成 _Itoa_s
4.error C2440:“static_cast” 无法从“void (__thiscall CChatManagerDlg::* )(WPARAM,LPARAM)”转换为“LRESULT (__thiscall CWnd::* ),出错处在ON_MESSAGE(WM_SETPLAY,OnSetPlay)
解答:将void CVideoBaseView::OnSetPlay(WPARAM wp,LPARAM lp) 改成LRESULT CVideoBaseView::OnSetPlay(WPARAM wp,LPARAM lp){
LRESULT result = Default();
//你原来的代码
return result;}
5.找不到MFC80D.DLL
解决:“工程属性”->“link”->“manifesto file”->“$(IntDir)/$(TargetFileName).intermediate.manifest” 值 改成 $(IntDir)/$(TargetFileName).manifest
文章出处:http://www.diybl.com/course/3_program/vc/vc_js/200879/132413.html