이 오류와 관련하여 도움을 줄 수 있습니까? 저는 C++ 초보자입니다. 그리고 매크로 오류에서 바로 오류가 발생합니다. 그것을 해결하기 위해 무엇을 할 수 있습니까? 또는 어떻게 그것을 근원까지 추적 할 수 있습니까?C++의 캐스팅 오류
나는이 오류를 정말로 이해하지 못한다. 컴파일러가 void ReadCPUparameter()
메서드를 LRESULT funcName(WPARAM wParam, LPARAM lParam)
함수 헤더로 변환하려고 했습니까? .
오류 :
// error C2440: 'static_cast' : cannot convert from
// 'void (__thiscall CStartup::*)(void)' to
// 'LRESULT (__thiscall CWnd::*)(WPARAM,LPARAM)'.
//
// ON_MESSAGE(WM_UPLOAD_CPU_PARAMETER,ReadCPUparameter) // error here
(나는이 작성하지 않은 내가 Win7에 시스템에 Win2000의에서 오래 프로젝트를 다시 컴파일 할 필요가 올드 VS6.0 프로젝트 -> VS2010 교수. .)
코드 :
// class CStartup : public CDialog {};
#include "stdafx.h"
#include "MU.h"
#include "Startup.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CStartup::CStartup(CWnd* pParent /*=NULL*/) : CDialog(CStartup::IDD, pParent)
{
p_p = &cpu_par;
}
void CStartup::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CStartup, CDialog)
ON_WM_SHOWWINDOW()
ON_MESSAGE(WM_UPLOAD_CPU_PARAMETER,ReadCPUparameter) // error here
END_MESSAGE_MAP()
const int nLanguageIds_Language[] =
{
// ...
};
#define MAX_READINGS 200
BOOL CStartup::OnInitDialog()
{
// ...
}
void CStartup::OnOK()
{
CDialog::OnOK();
}
int CStartup::Check_OnRead()
{
// ...
}
void CStartup::ReadCPUparameter()
{
// ...
}
void CStartup::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
PostMessage(WM_UPLOAD_CPU_PARAMETER);
}
에 함수 서명을 변경,
CWND
에서CDialog
상속을 것 같아요. 그렇다면 함수 시그니처를 예상되는 시그니처에 고치는 것이 어떻습니까? –@vlad_tepesch 당신이 의미하는 기능을 가르쳐 주시겠습니까? 그리고 질문의 두 번째 단락을 읽으십시오. C++ 오류에 익숙하지 않습니다. – Bitterblue