【发布时间】:2017-10-06 08:06:53
【问题描述】:
第一次使用Visual Studio 2017 Enterprose,无法制作简单的键盘处理程序。
我得到这个编译错误:
错误:C2593 'operator +=' 不明确
在以下代码段中:
void CAppView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CView::OnChar(nChar, nRepCnt, nFlags);
CAppDoc *pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->d+=nChar;
//Invalidate();
}
我使用了相同的代码,它在 VS 6.0 企业版的 MFC C++ 应用程序中工作。
【问题讨论】:
-
pDoc->d是什么?你能尝试创建一个Minimal, Complete, and Verifiable Example 并展示给我们看吗? -
另外,请将 full 和 Complete 错误输出复制粘贴到问题中。此类错误消息通常包含更多信息说明,说明编译器为何认为存在歧义。
-
您绝对需要提供
CAppDoc::d的定义。尽管如此,我们只能猜测。有一个叫d的类成员真的很难看。